Question: Source material: Object-Oriented Data Structures Using Java, 3rd Edition by Nell Dale. What is the answer to exercise 7 in chapter 3 (Page 232)?? Create

Source material: Object-Oriented Data Structures Using Java, 3rd Edition by Nell Dale.

What is the answer to exercise 7 in chapter 3 (Page 232)??

"Create a generic link-based bag class that features all the functionality of the Bag class specified in exercise 29 of chapter 2. Create a driver application that demonstrates that your implementation works correctly."

From exercise 29 of chapter 2 for quick reference:

"A StringBag ADT is similar to a StringLog ADT. Clients can insert strings into it, clear it, use it's toString, and check to see if it is full. However, for a bag rather than checking to see if it contains a given string, the client can only remove a random string (as if the client is blindly reaching into a bag of candy and taking one piece). The remove method randomly selects a string from the bag, "deletes" it from the bag, and returns it to the client. The number of copies of a string that are put into the bag IS important- if three "lollipop" strings are inserted, then three "lollipop" strings can be removed. We can assume that remove is not called if the bag is empty, therefore a bag should include an isEmpty method that returns whether or not the bag is empty, for the clients use."

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!