Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 +Onlineshopping Cart() *getList(): ArrayList tremove(): Boolean tadd(): void +checkout():void +changeQuantity(): Boolean +toString(): String +totalPurchaseAmount(): double +totalWeight(): double shipping Cost() . Driver class Once you have implemented all the classes copy and paste the following code in the main method. then run your program. Write your own code by creating another shopping cart and putting item in it. . 2) Online Shopping Cart myCart = new Online ShoppingCart(); OnlineItem iteml - new OnlineItem("123456", "Shirt", "red cotton". 1, 15.00. 1.3); myCart.add(steml); OnlineItem item2 = new Online Item("23", "Shoes", "Addidas", 1, 55, mycart.add(item2); OnlineItem item3 = new Online Item("987". "Basketball", "Addidas", 1, 25, 3). myCart.add(item3); OnlineItem items = new Online Item("5643", "Camera", "Kodak", 1, 150, 2.3) myCart add (item4): \/reviewing the cart System.out.println(myCart). W/checking out mycart.checkout(); Sample output: refer to the provide output.txt file output - Notepad File Edit Format View Help Your Shopping Cart Item: Shirt Description: red cotton Barcode: 123456 Quantity: 1 Price: 15.0 total: 15.0 *** Item: Shoes Description: Addidas Barcode: 23 Quantity: 1 Price: 55.0 total: 55.0 **** Item: Basketball Description: Addidas Barcode: 987 Quantity: 1 Price: 25.0 total: 25.0 ***** Item: Camera Description: Kodak Barcode: 5643 Quantity: 1 Price: 150.0 total: 150.0 *** uantity: 1 Price: 150.0 total: 150.0 *** Checking out Your Shopping Cart Item: Shirt Description: red cotton Barcode: 123456 Quantity: 1 Price: 15.0 total: 15.0 8. Item: Shoes Description: Addidas Barcode: 23 Quantity: 1 Price: 55.0 total: 55.0 *** Item: Basketball Description: Addidas Barcode: 987 Quantity: 1 Price: 25.0 total: 25.0 Item: Camera Description: Kodak Barcode: 5643 Quantity: 1 Price: 150.0 total: 158.0 B* Subtotal: 245.0 Tax: 18.9875 Free Shipping Amount due: 263.99

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

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

(1 point) Calculate 3 sin x cos x dx.

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago