Question: Simplified Online Shopping System ( Pls solve in JAVA ) The system contains: Person - Attributes: name , address , email - Methods: getDetails (
Simplified Online Shopping System Pls solve in JAVA
The system contains:
Person
Attributes: name address email
Methods: getDetails
Customer
Attributes: customerID shoppingCart a list of ItemToPurchase objects
Methods: addToCartItemToPurchase itemremoveFromCartItemToPurchase itemviewCart
Cashier
Attributes: cashierID
Methods: processPaymentCustomer customergenerateReceipt
ItemToPurchase
Attributes: itemName quantity price
Methods: getTotalPrice
ShoppingCart
Attributes: cartItems a list of ItemToPurchase objectstotalPrice
Methods: addItemItemToPurchase itemremoveItemItemToPurchase itemcalculateTotalPrice
OnlineShoppingSystem
main
Note: You can add more class members attributes methods if you wish.
How It Works:
The program main method takes user input for both customer and item details.
It adds items to the customer's shopping cart and calculates the total price.
It then displays a summary of the purchase, including the total cost.
The cashier processes the payment and generates a receipt at the end.
Explanation
Get Customer Details: The program starts by prompting the user to enter the customer's name, address, email, and customer ID This information is used to create a Customer object.
Get Cashier Details: Then, the program prompts the user to enter the cashier's ID A Cashier object is created with this ID
Item Entry: have two versions
Read from keyboard
The program asks how many items the customer wants to purchase.
For each item, the program prompts the user to enter:
Item Name
Item Price
Item Quantity
Read the above data from the input file
Each item is then created as an ItemToPurchase object and added to the customer's shopping cart.
Display Results: After collecting all the item information, the program
Displays the customers name, cashier's ID and the list of items purchased.
Calculates the total cost by summing up the total price of each item in the shopping cart.
Displays the total cost. Sales tax can be considered, but it's optional
Payment Processing: Finally, the virtual cashier processes the payment, and a receipt is generated for printing or emailing. just output a message on the console to simulate this step
Sample Input
Enter customer name: Larry Doe
Enter customer address: Main St
Enter customer email: larry.doe@example.com
Enter customer ID: Ccan be hard coded
Enter cashier ID: can be hard coded
Enter number of items to purchase: all item information can also be read from the input file you created
Enter details for item :
Item name: Laptop
Price:
Quantity:
Enter details for item :
Item name: Headphones
Price:
Quantity:
Sample Output
Order Summary
Customer: Larry Doe
Cashier ID:
Items Purchased:
x Laptop @ $ each
x Headphones @ $ each
Total Cost: $
Processing payment for Larry Doe
Generating receipt...
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
