Question: I need help with this to do tasks. I was wondering if anyone can help me explain what should I do. Also can you just

 I need help with this to do tasks. I was wondering
if anyone can help me explain what should I do. Also can
you just send me a screenshot. Appreciated public void testAdd() ! //Create

I need help with this to do tasks. I was wondering if anyone can help me explain what should I do. Also can you just send me a screenshot. Appreciated public void testAdd() ! //Create grocery objects and a shopping 11st instance Grocery iteml - new Grocery("Harry Potter", "book", 3, 15.5f, 2): Grocery item2 - new Grocery (iteml): item2. set Quantity (3): ShoppingListArrayList instance = new ShoppingListArrayList(): // TODO test the add method for the case of adding a new item (itemi) into Inst instance // Be sure that 1/1) size is increased by 1 W 2) the first item in the list is Vi the name as in the reference variable, item // TODO test the combine" feature of the add method for the case of adding an existing entry, the item 11 into the shopping list instance created in previous W code block. The item has the same entry name as the item, W Be sure that W 1) size is not changed 172) quantities are W properly changed in the first item in the list. 1 Tent adding a null entry reference to the shpping list instance.add(null); assertTrue (1 + instance.size()); // Test creating and adding a new grocery object to the list W Be sure that 11) the shopping list has a proper number of items W 2) the list item in the list W is the same as in the newly created grocery object Grocery item3 = new Grocery ("Laugh in the Rain", "book", 3, 35.5f, 1); instance.add (item3): System.out.println("Teat..." + instance.size()); assert True (2= instance.size()); try assertTrue (items.compare To (instance.find(1)) - 0): assert True (1 - item3.getQuantity()); assert True (1 instance. Find (1).getQuantity): } catch (Exception ex) { ex.printStackTrace(): public void add (Grocery entry) { 1/ Check if exists if (contains (entry)) { //Adds the quantity of new entry into existing entry combine Quantity (entry); return; } // Expand if necessary if (size shoppingList.length) { this.expandCapacity(); } shoppingList[size] = entry; size++

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!