Question: Creating two Java classes and a tester program: Item Class: Every item has a price and name variable associated with it. The Item Class should

Creating two Java classes and a tester program:

Item Class: Every item has a price and name variable associated with it. The Item Class should have accessor methods for each variable, a method that reduces the price of the item accordingly:20% if the price is greater than $50,10% if the Item is priced between $25-$50 inclusive,no discount if the price is less than $25,a mark-up method that increases the price by the amount provided as a parameter, and a toString method.

ShoppingCart Class: Every shopping cart item has an ArrayList of the items it contains, a total cost variable, and a variable that represents the amount of money the shopper has to spend. the shopping cart class should have an add method that allows the user to fill the shopping cart with objects from the Item Class, a remove method which determines the most expensive item and removes it from the cart ,a method that calculates the total cost of the cart, and a method with a boolean return type that determines if the shopper has enough money for their items.

Tester Program: Create and fill a shopping cart. Utilize the methods of the ShoppingCart Class to determine if our code works correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!