Answered step by step
Verified Expert Solution
Question
1 Approved Answer
//SHELL CODE link https://drive.google.com/file/d/1zr_rdtit1uKW0AfZUGtLrVCiPS8dtvgq/view?usp=sharing bbjective In the assignment you will be practicing one of the Java's collections called ArrayList which is in the util backage.
//SHELL CODE link
https://drive.google.com/file/d/1zr_rdtit1uKW0AfZUGtLrVCiPS8dtvgq/view?usp=sharing
bbjective In the assignment you will be practicing one of the Java's collections called ArrayList which is in the util backage. Click here to see the ArrayList class description and its methods. Problem You are going to create an online shopping store allowing customers to purchase items and place them in their shopping carts. Once the customer is ready they will check out with the list of the purchased items and the total money that needs to be paid including the shipping and the tax amount. What kind of items would you like to sell in your virtual store? Feel free to add attributes and functionalities(methods) to the classes if needed. This will be your store so make sure that all the functionalities are working properly. Requirements you work must satisfy all the criteria listed in the rubrics must have all the methods Fell free to add more methods/functionalities Feel free to use your logic for implementing each method. . The description of each method is given in the provided java shell . Method descriptions The descriptions for the methods in the different classes are given in the provided java shell. . Required classes item class onlineitem class (an Onlineltem is an Item) Shopping Cart class (A Shopping Cart has Onlineltems in it) . driver class Item class Create the item class based on the following UML Compile your code as you add more methods. item barCode: String price: double //price of the item cannot be negative - name: String /ame of the item description: String // description of the item quantity: int //quantity that can be purchased, cannot be negative +Item(String barcode, double price, String name, String description, int quantity) +getPrice(): double tgetQuantity(): int +getDescription(): String +getBarCode(): String tsetPrice(double price): Boolean //if the price is negative returns false and the price will not be changed #setQuantity(int q): Boolean //if the price is negative returns false and the price will not be changed #setDescription(String des):void I setBarCode(String code): void #toString(): String //returns a string representing the item including all the attributes tequals (Object o): boolean // compares two items based on the bar code. Type cast the object o first +getTotal (): double //returns the total cost of the item based on the quantity Onlineltem class This class extends the item class since onlineltem is an Item Onlineltem extends Item -weight: double // this attribute is used to calculate the shipping cost +Onlineltem(String bar, String name, String description, int quantity, double price, double weight) #getWeight(): double toString():String OnlineshoppingCart This class should have a list of the online items since a shopping cart has shopping items in it. There is a has a relationship between this class and the onlineltem class. This class has the most work since it will be calling methods from other two classes. Onlineshopping Cart public static final int SHIP_RATE=3; -list: ArrayList
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started