Question: A customer can have multiple baskets during checkout and each basket can have one or many products. Write a Checkout class that can contain any
A customer can have multiple baskets during checkout and each basket can have one or many products.
Write a Checkout class that can contain any number of Basket objects and the following operations
Attempts to add a basket object to the arraylist
if the arraylist already has an object with the same basketld, then don't add it and return false
if the arraylist does not have an object with the same basketld, then add it and return true
public boolean addBasketToCheckoutBasket b
Attempts to remove a basket object from the arraylist
if the arraylist has an object with the same basketld, then remove it from the arraylist and return true
if the arraylist does not have an object with the same basketid, then return false
public boolean removeBasketFromCheckoutBasket b
Find the average number of products on the baskets in arraylist
return the average number of products per basket for the fleet public double computeAvgNumOfProducstOnBasketsInCheckout
Please write in java, URGENT
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
