Answered step by step
Verified Expert Solution
Link Copied!

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
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

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

Explain the causes of indiscipline.

Answered: 1 week ago

Question

How would we like to see ourselves?

Answered: 1 week ago

Question

How can we visually describe our goals?

Answered: 1 week ago

Question

What metaphors might describe how we work together?

Answered: 1 week ago