Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task is to create a basic Cart System where an App system reads from a file of default items and displays those items to

Your task is to create a basic Cart System where an App system reads from a file of default items and displays those items to the user in order to add them to their cart. A new item can be added at any time to the system (Only at runtime and it does not need to be saved in the file with default items). Items can be removed from the System as well as from the cart. Work-Flow: The Cart System starts by asking the user to select whether they would like to: 1. Add an item to the System: In this case, the system asks the user to enter the new item's name, a description for the new item, the new items price and the available quantity of the new item, finally the new item will be added to the app. 2. Add an item to the Cart: In this case, the system displays all of the available items in the app system and asks the user to enter the name of an item to be added to the cart. The item will be added to the cart by searching the name for that item in the collection of items available in the app system. If the item has already been added to the cart, the quantity of that item in the cart is increased by one. 3. Display Cart: All the items in the cart are displayed, the system then calculates the sub-total by calculating the total sum of the products of the price and quantity of each item in the cart (Sum (item's price * item's quantity)). The sub-total is displayed along with the tax, which is (sub-total * 0.05), and the total, which is (sub-total + tax) for all items in the cart. 4. Display System: The system displays all the items that are available in the app. 5. Remove an item from the cart: In this case, the system asks the user for the name of the item to be removed from the cart. 6. Remove an item from the system: In this case, the system asks the user for the name of the item to be removed from the app. If an item is removed from the app, but it was already added to the cart. It will also be removed from the cart. 7. Quit: This option terminates the program.

Requirement 1: Model Class: A class Item should contain the private instance variables specified in TABLE 1 with associated GETTERS and SETTERS. The purpose of the item class is to carry data related to an item. TABLE 1: Datatype Name Description String itemName Name of the item String itemDesc Contains the item's description Double itemPrice Contains a double value which represents the items price Integer quantity Represents the number of items the user has added to the cart Integer availableQuantity Represents the number of items available in the system *The following constructor must be implemented: Description Input Parameters This constructor initializes quantity to 1 None( do in JAVA)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions