Project Objective:
The purpose of this project is to enable the students to demonstrate their
understanding of object
oriented concepts in building a simulation of an Online Shopping Store. You will be
able to
combine your knowledge of encapsulation, abstraction, and inheritance along with
different
techniques such as working with files that you have learned throughout the semester
to develop
this system. The application has two types of users:
� Administrator
� Customer
Project Requirements:
Phase 1: Designing the classes of your application
(1) Create a UML class diagram that models at least four classes (you can add more
classes as you see
necessary) as follows:
� A class called User with userID, username (for login), password, email, and
userType (either
�admin� or �customer�)
� An abstract class called Item with data fields itemID, itemName, price, and the
following abstract
methods:
a. orderSummary that takes a parameter called �quantity� of type integer and then
it will show
the purchase summer to the customer (will be used when the customer buy a specific
item).
b. showItems that reads all the contents of the file (clothes.txt or makeup.txt)
and display it on
the console.
c. searchItems that takes a parameter �itemID� and returns a boolean value
indicating if it exists.
d. writeItems that will be used by the admin user to add an item to the file
(clothes.txt or
makeup.txt)
e. deleteItems that takes a parameter �itemID� and will be used by the admin user
to search for
an item and delete it from the file if it was found.
� Two subclasses of class Item that are called Clothes and MakeUp.
� Class Clothes contains color, department, and size
� Class MakeUp contains brand, category, and season
(2) Create a project called Online Shopping Store (OSS) and implement the
aforementioned classes.
(3) Declare some overloaded constructors with parameters for each class, along with
appropriate methods
as you see fit, and declare the data fields to be private or protected as you see
necessary.
(4) The items in both categories will be stored in two separate text files
(clothes.txt and makeup.txt) as shown below:
----------------
Clothes file:
------------------------------------------------------------------
itemID, itemiane, color, department, size, price
2001 Shirt, blue, men, L,12,,
2002, Dress,green, women, XL,500,
2003 Pants, yellow, kids,M,31,,
-------------------------------------------------------------------------
----------------
makeup file:
------------------------------------------------------------------
itenID, itenane, brand, category, season,price
1001, Lip Last Matte, Sephora, Lipstick, Summer,120,
1002, Eyeshadow XB, MAC, Eyeshadow, All Season, 330,
1003,Back Stage, Dior, Foundation, Limited Edition,410,
-----------------------------------------------------------------------
When either users (Admin or Customer) log-in into their respective account, the
items from both files
will be displayed on the console window (as shown below):
run:
Enter user name: Nuha
Enter user Id: 1234
^^^^^^^^^^^^^^^ Welcome to the Admin view ^^^^^^^^^^^^^
Clothes file:
itemID, itemiane, color, department, size, price
2001 Shirt, blue, men, L,12,,
2002, Dress,green, women, XL,500,
2003 Pants, yellow, kids,M,31,,
***************************************************************
Makeup file:
itenID, itenane, brand, category, season,price
1001, Lip Last Matte, Sephora, Lipstick, Summer,120,
1002, Eyeshadow XB, MAC, Eyeshadow, All Season, 330,
1003,Back Stage, Dior, Foundation, Limited Edition,410,
***************************************************************
Phase 2: Designing the main class of the application
(5) design a class named TestOnlineShoppingStore that contains the main() method
where you can
run your program, inside the main() write the code to perform the following:
1. Once you run the program, the user should be asked to login. Note, there are two
types of users:
Admin, and Customer. In this project, you can hard-code the credentials of the
Admin and the
Customer, and one account of each type of users will be enough. If the
authentication process
succeeded, the user (Admin or Customer) can move to the next step.
2. If the user logged in as an Admin, the list of items from each file will be
displayed on the
console window and a menu appears where he can perform the following tasks (as
shown
below):
a. Adding a new item to either clothes.txt or makeup.txt files.
b. Deleting an existing item from either clothes.txt or makeup.txt files.
c. Exiting the menu.
d. Exiting the application and terminating the program.
And the output will be as the below:
run:
Enter user name: Nuha
Enter user Id: 1234
^^^^^^^^^^^^^^^ Welcome to the Admin view ^^^^^^^^^^^^^
Clothes file:
itemID, itemiane, color, department, size, price
2001 Shirt, blue, men, L,12,,
2002, Dress,green, women, XL,500,
2003 Pants, yellow, kids,M,31,,
***************************************************************
Makeup file:
itenID, itenane, brand, category, season,price
1001, Lip Last Matte, Sephora, Lipstick, Summer,120,
1002, Eyeshadow XB, MAC, Eyeshadow, All Season, 330,
1003,Back Stage, Dior, Foundation, Limited Edition,410,
***************************************************************
Please choose from the following tasks:
1-Add a clothe item
2-Delete a clothe item
1-Add a makeup item
4-Delete a makeup item
5-Exit the menu
6-Exit the application
Enter your choice: 2
Enter an item ID to be deleted: 2003
Item was deleted successfully!
The following is the complet of requirement of project in phase 2 :
3. If the user logged in as a Customer the list of items from each file will be
displayed on the
console window and a menu appears where he can perform the following tasks (as
shown
below):
a. Buying an item from �Clothes� or �MakeUp�. Note that the customer must enter the
�itemID�
in order to search for an item and complete the purchase transaction. Also, the
customer can
specify the quantity for the item that he wants to purchase, and when the purchase
transaction
is complete, the order summary will be displayed at the console. The purchase
summary will
be displayed using the method �orderSummary�.
b. Exiting the menu.
c. Exiting the application and terminating the program.
Run:
Enter user name Samar
Enter user Id: 5670
------------------------------- Welcome to the Customer
view-------------------------------
Clothes file:
itemID, itemiane, color, department, size, price
2001 Shirt, blue, men, L,12,,
2002, Dress,green, women, XL,500,
2003 Pants, yellow, kids,M,31,,
***************************************************************
Makeup file:
itenID, itenane, brand, category, season,price
1001, Lip Last Matte, Sephora, Lipstick, Summer,120,
1002, Eyeshadow XB, MAC, Eyeshadow, All Season, 330,
1003,Back Stage, Dior, Foundation, Limited Edition,410,
***************************************************************
Please select an option from the following menu:
1-Buy clothes
2-Buy makeup
3-Exit the menu
4-Exit the application
Enter your selection: 1
Please Enter the following information to buy clothes:
Enter an item ID: 2002
Enter an item quantity: 2
Purchased Item: 2002, QTY= 2, Total Price= 1000.0
******************Thank you for shopping*************
4. Use the following programming constructs/tools as you need it:
a. A while/ do-while loop to show a menu to the user.
b. switch statements to select the required task.
c. ArrayList, if statements.
5. Use the text files attached to this project (clothes.txt and makeup.txt) to test
your implemented
classes.
..
..
..
Go smartly