A stringbag adt is similar to a stringlog adt


A stringbag ADT is similar to a stringLog ADT, Clients can insert strings into it, clear it, use its 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 "lollypop" strings are inserted, then three "lollypop" strings can be removed. We can assume that 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. For example, the client here might produce the output shown below it:

StringBag b = new StringBag(5);
b.insert ("Jeannine");
b.insert ("Dora");
b.insert ("Dora");
b.insert ("Jo-Anne");
while (!b.isempty())
{
System.out.println(b.remove());
}
Dora
Dora
Jo-Anne
Jeannine

Design a StringBag ADT, define it with a StringBag interface, and then ment it using private array to hold the inserted strings. Design a test that shows that your StringBag. Java class works correctly. Create that documents your design decisions, lists your interface, Class, and driving shows the results of using the driver, and describes your experience project (What went well, what went wrong, etc.). 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: A stringbag adt is similar to a stringlog adt
Reference No:- TGS093853

Expected delivery within 24 Hours