Question: Part II Programming (Programming problem 1) First, please specify the Bag ADT using an interface called Baggable. In this interface, you may want to include

 Part II Programming (Programming problem 1) First, please specify the Bag

Part II Programming (Programming problem 1) First, please specify the Bag ADT using an interface called Baggable. In this interface, you may want to include the following method hendings: add, remove, numOfitems, contains, displayBag. Second, please define a ArrayBag class that implement the Baggable interface using an array. (a).add() method takes an object as input parameter (you can use generic type T or specify some other types such as Integer) the add method will return true if successfully add an item in the bag, otherwise return false (b).remove() method takes method takes an object as input parameter (you can use generic type Tor specify some other types such as Integer) the remove method will return true if successfully remove an item in the bag, otherwise return false. (c). numOfitems() method will return the current size of the bag (d). contains() method will return true if a specific object is in the bag, otherwise return false. (e), displayBag() method will print all the items in the bag. Please add necessary documentations. You are also expected to write your own tester class to thoroughly test your code

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!