Question: Implementing BookArrayBag Book -title: String - year : int + Book ( title : String, year: int) + getTitle(): String + getYear(): int + setTitle

 Implementing BookArrayBag Book -title: String - year : int + Book( title : String, year: int) + getTitle(): String + getYear(): int+ setTitle (title : String): void + setYear (year: int) : void

Implementing BookArrayBag Book -title: String - year : int + Book ( title : String, year: int) + getTitle(): String + getYear(): int + setTitle (title : String): void + setYear (year: int) : void + equals ( obj: Object): boolean + toString(): String BookArrayBag - data : Book[] manyltems : int + BookBag () + BookBag ( capacity: int ) + add (b: Book ) : void + remove (b: Book ) : void + size(): int + grab (index : int ): Book + find (b: Book): Book + countOccurrences (b:Book): int + toString(): String + max(): Book *Two books are equal when they have the same title (case insensitive). ICS 240-50: Introduction to Data Structures - Spring 2022 Consider the BookArrayBag application from slide #6 in the lecture-03-jan-28.pptx. Consider also the following BookArrayBagDriver, 8 public class BookArrayBagDriver { 90 public static void main (String args[]) { 10 BookArrayBag myBag = new BookArrayBag(5); 11 myBag.add(new Book ("Database", 2011)); 12 myBag.add(new Book ("Operating Systems", 1991)); 13 Book algorithms = new Book ("Algorithms", 1991); 14 myBag.add(algorithms); 16 System.out.println(myBag); System.out.println(myBag.size()); 18 System.out.println(myBag.grab(2)); System.out.println(myBag.find(new Book("Database", 0))); Book programming = new Book("programming", 0); if (myBag.find(programming)==null) myBag.add(programming); 27 System.out.println(myBag); myBag.remove(new Book("algorithms",0)); System.out.println(myBag.countOccurances (algorithms)); myBag.remove(new Book ("Database",0)); System.out.println(myBag.grab(0)); 1 Fill in the following table to show what is printed on the screen or to show the data array of the myBag instance. Line 16: Draw data array Line 17 output: Line 18 output: Line 21 output: Line 27 draw data array: Line 30 draw data array: Line 30 output: Line 33 draw data array: Line 33 output

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!