Implementation of a Bag for Clothing Boutique Products in Java Project

Verified

Added on  2023/04/04

|6
|649
|490
Project
AI Summary
This Java project focuses on implementing a `ClothingBag` class to store and manage products for a boutique. The program allows users to add, remove, and display items in the bag, with a defined capacity. The project utilizes core Java concepts, including classes, objects, arrays, and methods like `add()`, `toArray()`, `isFull()`, and `displayBag()`. The `Scanner` class is employed for user input, and the program demonstrates the use of private members to encapsulate data and control access. The implementation also highlights the benefits of using an abstract data type (ADT) like a bag for managing collections of objects without revealing implementation details, and the use of getter and setter methods. References to relevant literature are provided to support the design and implementation choices.
Document Page
Running head: CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
1
Assignment
Student
Course
Instructor
Date
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
2
Introduction
In the given program the main objective is to create a class that will store the products of a
boutique in bag. The class implemented is capable of storing different items of the boutique and
the bag created can be able to set the capacity accordingly. The data type order of the products
insertion into the bag is not fixed, it can be stored and removed accordingly to the user. The
abstract data type myBag is used to intent the use and suggestion of collection of certain objects
that can be familiar for the users and developers.
Program discussion
The activities available for the suggested bag implementation include inserting new values,
removing the elements, checking for an item to see if that value is stored in the item or bag
collection. In addition, the amount of elements / objects in the bag can also be found.
Besides that, since there are issues that require looping capacity over all the components in the b
ag / container(Schildt,2014). This can be accomplished in the data structure of Bag without revea
ling execution information or knowing how to organize the collection in the memory. Also, bag
is useful in building a set in java. Most of the features are the same in set with only change to add
the element where it checks whether or not the fresh value is already present in the collection.
The program consist of the class named as Clothinbag (Liang & Tsai, 2013). The class variables
are declared as private members to hide the data and methods to hide the program's complex
logic and unintended changes to the values stored in the variables. In this manner, the class
characteristics and techniques can be improved and better controlled. This makes the declared
class variables read-only or write-only. The variables assigned for the program were
MyType[]myBag this is the array used to store all the values of the bag, int numberofproducts
Document Page
CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
3
this variable is used to store the number of products a customer has bought or has in their bag,
Capacity variable is used to assign the capacity of the bag (Goodrich, Tamassia &
Goldwasser,2014).
The methods used in the program are a constructor which is used to in initialize the bag. add()
this method is used to add the orders or products into the bag. The toArray() method is used to
add the product into an array which is allocated for the bag. The isFull() function is used to
check whether the bag is in its maximum capacity or not (Joyce & Weems, 2016). The testAdd()
function is used to add the content to the bag created in the toArray() method. Finally the
displayBag() method is used to display the items stored in the bag.
Conclusion
The Scanner class is also used in the full execution of the program to get the user input and store
the value in the variables. In the java.util package, this class is accessible. An object is developed
to use the Scanner class and the techniques of getter setter earlier declared are used to assign
values to the variables. In the developed program the displayBag() method is used for the display
of items contained in the bag.
Document Page
CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
4
Screenshot of the program
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
5
References
Schildt, H. (2014). Java: the complete reference. McGraw-Hill Education Group.
Liang, Y. D., & Tsai, M. J. (2013). Introduction to Java programming: brief version. Pearson.
Goodrich, M. T., Tamassia, R., & Goldwasser, M. H. (2014). Data structures and algorithms in
Java. John Wiley & Sons.
Joyce, D. T., & Weems, C. (2016). Object-oriented data structures using Java. Jones & Bartlett
Publishers.
Document Page
CLOTHING BOUTIQUE BAG IMPLEMENTATION IN JAVA
6
chevron_up_icon
1 out of 6
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]