Question: Write classes to model a shopping list. Make an Item class that represents a grocery items name and price, such as tissues for $3. Also
Write classes to model a shopping list. Make an Item class that represents a grocery item’s name and price, such as tissues for $3. Also implement an ItemOrder class that represents a shopper’s desire to purchase a given item in a given quantity, such as five boxes of tissues. You might wish to implement bulk-discounted items, such as two boxes of tissues for $4, which would bring the cost of the given item order of 2 + 2 + 1 boxes of tissues to $4 + $4 + $3, or $11.00. Lastly, implement a ShoppingCart class that stores ItemOrder s in an ArrayList and allows item orders to be added to, removed from, or searched for in the cart. The cart should be able to report the total price of all item orders it currently carries.
Step by Step Solution
3.56 Rating (156 Votes )
There are 3 Steps involved in it
public class Catalog private String name private ArrayList items public CatalogString name thisname name items new ArrayList public void addItem next itemsaddnext public int size return itemssize publ... View full answer
Get step-by-step solutions from verified subject matter experts
