Question: KeyValue key: int value: double setKey ( ( at ) :void getKey ( ) :int setValue ( double ) :void getValue ( ) :double Notes:

KeyValue
key: int
value: double
setKey((at):void
getKey ():int
setValue(double):void getValue():double
Notes:
ocAbstract class DataCollection
#Datal]: KeyValue
final CAP: int(20)
+insert KeyValue):void remove():void
Interfacess
Scrambler
swapperfint, Int) veld
DataBook
sire: int getAverage() double *shuffle():void
1. Scrambler: an interface with one method
2. Key Value class:
Assume this class is completely implemented, DO NOT code it. Use its methods when you code the other classes.
3. DataCollection:
Its insert and rensove methods are abstract
Create a constructor for this class that creates Data with size equal to CAP
4. DataBook:
Data: stores "size" Key Value objects, and cannot store more than CAP objects.
getAverage: returns the average of all Key Value objects in the array Data in terms of their "value" values. shuffle: calls the swapper method 5 times, each time it gets the indices of
the two Key Value objects to be swapped from the user using a Scanner to read from the keyword. Each index must be between 0 and size-1 inclusive, if the user fails to provide a valid index, the call to swapper is skipped. swapper(int1, int2): exchanges the two Key Value objects stored at the indices int1, and int2 in Data
insert: adds a Key Value object at the end of Data, if size

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!