Question: 1. Create a Bag interface using the example in the lesson. Implement it in a ShoppingCart class for storing the items in the cart for
1. Create a Bag interface using the example in the lesson. Implement it in a ShoppingCart class for storing the items in the cart for online shopping. Test all the methods of the class in a CreateCart demo code.
2. Implement the bag interface in PiggyBank class for adding coins and money in the piggy bank. Test all the methods of the class in a demo code.
public class OnlineShopper public static void main(String[] args) Item[] items {new Item("Bird feeder", 2050) new ItemC"Squirrel guard", 1547), new Item("Bird bath", 4499), new Item("Sunflower seeds", 1295)}; BagInterface
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
