Question: KeyValue key: int value: double setKey ( ( at ) :void getKey ( ) :int setValue ( double ) :void getValue ( ) :double Notes:
KeyValue
key: int
value: double
setKeyat:void
getKey :int
setValuedouble:void getValue:double
Notes:
ocAbstract class DataCollection
#Datal: KeyValue
final CAP: int
insert KeyValue:void remove:void
Interfacess
Scrambler
swapperfint, Int veld
DataBook
sire: int getAverage double shuffle:void
Scrambler: an interface with one method
Key Value class:
Assume this class is completely implemented, DO NOT code it Use its methods when you code the other classes.
DataCollection:
Its insert and rensove methods are abstract
Create a constructor for this class that creates Data with size equal to CAP
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 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 and size inclusive, if the user fails to provide a valid index, the call to swapper is skipped. swapperint int: exchanges the two Key Value objects stored at the indices int and int 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
