Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help there no other information. Implementing BookArrayBag Book - title : String - year : int + Book ( title : String, year :

image text in transcribed

image text in transcribed

please help

there no other information.

image text in transcribed

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 Styles Editing Voice Exercise 2: replace method in IntArrayBag Implement an instance method belonging to the IntArrayBag class that takes two input parameters, oldVal and newVal. The method replaces each oldVal element in the array with newVal. Make sure to include the method header. Exercise 3: countInYear method in BookArrayBag Consider the BookArrayBag from slide #6 in the lecture-03-jan-28.pptx. Write an instance method belonging to BookArrayBag that takes one integer input, called year, and returns as output the number of books published in that year. Exercise 4: equalsTo method for IntArrayBag Implement a static method, called equalsTo, in the IntArrayBag's class that takes one input parameter and returns a boolean value. The input parameter is of type IntArrayBag. The method returns true if the input bag and the bag that activates the method have exactly the same elements. Otherwise the method return false. Note that the locations of the elements in the data arrays are not necessarily be the same, it is only the number of occurrences of each element that must be the same. : IntArrayBag - data:int[] - manyItems:int +IntArrayBag() +IntArrayBag(capacity:int) +add(element int):void +countOccurances (target:int): nt +grab (index:i) :int +remove(target:int) : void +size(): int +max(): int +toString(): String 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 Styles Editing Voice Exercise 2: replace method in IntArrayBag Implement an instance method belonging to the IntArrayBag class that takes two input parameters, oldVal and newVal. The method replaces each oldVal element in the array with newVal. Make sure to include the method header. Exercise 3: countInYear method in BookArrayBag Consider the BookArrayBag from slide #6 in the lecture-03-jan-28.pptx. Write an instance method belonging to BookArrayBag that takes one integer input, called year, and returns as output the number of books published in that year. Exercise 4: equalsTo method for IntArrayBag Implement a static method, called equalsTo, in the IntArrayBag's class that takes one input parameter and returns a boolean value. The input parameter is of type IntArrayBag. The method returns true if the input bag and the bag that activates the method have exactly the same elements. Otherwise the method return false. Note that the locations of the elements in the data arrays are not necessarily be the same, it is only the number of occurrences of each element that must be the same. : IntArrayBag - data:int[] - manyItems:int +IntArrayBag() +IntArrayBag(capacity:int) +add(element int):void +countOccurances (target:int): nt +grab (index:i) :int +remove(target:int) : void +size(): int +max(): int +toString(): String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions