Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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