Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please what will this difference line print? the slide #6 is the first picture. the slides #6 is the first picture. I don't have any
please what will this difference line print? the slide #6 is the first picture.
the slides #6 is the first picture. I don't have any other information.
Pour Labs Infosec... 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 8 public class BookArrayBagDriver { ge 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); 15 16 System.out.println(myBag); 17 System.out.println(myBag.size()); 18 System.out.println(myBag.grab(2)); 19 20 21 System.out.println(myBag.find(new Book ("Database", 0))); 22 23 Book programming = new Book('programming", 0); 24 if (myBag.find(programming)==null) 25 myBag.add(programming); 26 27 System.out.println(myBag); 28 29 myBag.remove(new Book("algorithms", 0)); 30 System.out.println(myBag. countOccurances (algorithms)); 31 32 myBag. remove(new Book ("Database", 0)); 33 System.out.println(myBag.grab(0)); 34 35 } } Consider the BookArrayBag application from slide #6 in the lecture-03-jan-28.pptx. Consider also the following BookArrayBagDriver. = 8 public class BookArrayBagDriver { 9 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); 15 16 System.out.println(myBag); 17 System.out.println(myBag.size()); System.out.println(myBag.grab(2)); 19 20 21 System.out.println(myBag.find(new Book ("Database", 0))); 22 23 Book programming = new Book ("programming", 0); 24 if (myBag.find(programming)==null) myBag.add(programming); 18 25 . Print 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 outputStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started