Question: Consider the IntArrayBagdata structure that is represented by the following UML. -data:int[] -wauxitemus.int +IntArrayBag IntArrayBag +IntArrayBag(capacity:int) +add(element:int):void +countOcuurances(target:int):int +grab(index:i):int +remove(target:int):void +size():int +change(oldValint, newValint):int (1)

Consider the IntArrayBagdata structure that is represented by the following UML. -data:int[] 

Consider the IntArrayBagdata structure that is represented by the following UML. -data:int[] -wauxitemus.int +IntArrayBag IntArrayBag +IntArrayBag(capacity:int) +add(element:int):void +countOcuurances(target:int):int +grab(index:i):int +remove(target:int):void +size():int +change(oldValint, newValint):int (1) Implement an instance method, called max, in the IntArrayBag class that finds and return the maximum value in the bag. (2) Implement a static method, called sumEven, in the IntArcaxBag class that takes one input parameter of type IntArrayBag. The method then calculates and returns the sum of all even elements in the bag. (3) Re-implement the sumEven method as an instance method (not static) in the IntArrayBag class. The method then calculates and returns the sum of all even elements in the bag. (4) Implement an instance method, called equals To, in the IntArrayBag's class that takes one input parameter and returns a Boolean value. The input parameter, called otherBag, is of type IntaxxaxBag as well. The method returns true if otherBag and the bag that activates the method have exactly the same number of every element. 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. (5) Re-implement the equals To method as a static method in the Driver class

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 Computer Network Questions!