Question: Restrictions: Unless directed otherwise, you cannot use any Java class libraries in this assignment. In particular: You cannot use the AtrayList class nor can you

 Restrictions: Unless directed otherwise, you cannot use any Java class librariesin this assignment. In particular: "You cannot use the AtrayList class norcan you use any methods from the Arrays class. *You cannot usethe SinglyLinkedlist class defined by Java nor can you use any other

Restrictions: Unless directed otherwise, you cannot use any Java class libraries in this assignment. In particular: "You cannot use the AtrayList class nor can you use any methods from the Arrays class. *You cannot use the SinglyLinkedlist class defined by Java nor can you use any other collection class from the Java library If needed: You may create and use one or more instances of an array and access the length instance variable for each array. You may duplicate the Singly Linked List class from the textbook (code fragments 3.14 & 3.15) You may use the Java Random class In this assignment you will be creating a generic version of Bag which would be a collection of items that the client would define. The Bag interface will be a Generic interface with a Type Parameter. Just like in Lab 102, Bag will not order the tem nor does it prevent any duplicates TASK 1 (very similar to Lab102 but generic): in any particular order, Develop a Generic interface named Bag that can store a certain number of items (type will be specified by the client). Provide the following methods in the interface: A method that returns the current count of items in the bag A method that checks if the bag is empty A method that adds an item to the bag A method that removes a random item from the bag as long as the bag is not empty. This method would return the removed item from the bag

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!