Question: 1 8 . 7 SortDriverGeneric Class zybooks You will write the SortDriverGeneric.java class which will implement the SortDriverInterfaceGeneric . The interface may be downloaded from
SortDriverGeneric Class zybooks
You will write the SortDriverGeneric.java class which will implement the SortDriverInterfaceGeneric The interface may be downloaded from here
Please note that, in addition to implementing the SortDriverInterfaceGeneric, you are also required to write your own public static mainStringargsmethod in SortDriverGeneric.java that performs all of the required tests as specified below.
Method Detail
createArray
java.lang.IntegerSortDiverInterfaceGenic
int aaysize
This method is used to create a new array of Integer objects of the type and size specified.
Parameters:
pe This parameter specifies the type of array to create. See the enum SortDriverInterfaceGeneric. Aayype
arraysize This parameter specifies the size of array to create.
Returns:
The method will return the aray of Integer objects that was created.
runSort
java.lang.ObjectrunSortSortDriverInterfaceGenericSortType sortType,
sortDriverInterfaceGeneic
int aaysize
int numberofTimes
This method will run the sortType for numberofTimes.
This method repeats the following numberofTimes:
Obtain an array of type arrayype
Make a copy of the array you obtained
Capture startTime
Call the appropriate sort
Capture endTime
Calculate testTime and add it to your TestTimes class
Make a copy of the sorted array
Parameters:
sortType This parameter specifies the sort algorithm that will be used. See the enum SortDriverInterfaceseneric.SortType.
arrayype This parameter specifies the type of array to create each time the sort is run. See the enum SortDriverInterfaceGeneric. ArrayType.
arraysize This parameter specifies the size of array to create each time the sort is run.
numberofTimes This parameter specifies the number of times to run the specified sort.
Returns:
The method must return an aay of object containing the following:
arraymust contain a copy of the unsorted array for first test.
arraymust contain a copy of the sorted array for first test.
arrayMust contain a copy of the unsorted array for second test.
aymust contain a copy of the sorted aray for second test.
arraynumberofTimesMust contain a copy of the unsorted array for the last test.
araynumberofTimesmust contain a copy of the sorted array for the last test.
arraynumberofTimesmust contain the TestTimes class that was used to save the measured test times for the sorts performed. has to pass :Unit tTest SortDriverGeneric.createArrayest
:Test SortDriverGeneric.runSort
Method Detail
createArray
java.lang.IntegerSortDiverInterfaceGenic
int aaysize
This method is used to create a new array of Integer objects of the type and size specified.
Parameters:
pe This parameter specifies the type of array to create. See the enum SortDriverInterfaceGeneric. Aayype
arraysize This parameter specifies the size of array to create.
Returns:
The method will return the aray of Integer objects that was created.
runSort
java.lang.Object runSortSortDriverInterfaceGenericSortType sortType,
sortDriverInterfaceGeneic
int aaysize
int numberofTimes
This method will run the sortType for numberofTimes.
This method repeats the following numberofTimes:
Obtain an array of type arrayype
Make a copy of the array you obtained
Capture startTime
Call the appropriate sort
Capture endTime
Calculate testTime and add it to your TestTimes class
Make a copy of the sorted array
Parameters:
sortType This parameter specifies the sort algorithm that will be used. See the enum SortDriverInterfaceseneric.SortType.
arrayype This parameter specifies the type of array to create each time the sort is run. See the enum SortDriverInterfaceGeneric. ArrayType.
arraysize This parameter specifies the size of array to create each time the sort is run.
numberofTimes This parameter specifies the number of times to run the specified sort.
Returns:
The method must return an aay of object containing the following:
array must contain a copy of the unsorted array for first test.
array must contain a copy of the sorted array for first test.
array Must contain a copy of the unsorted array for second test.
ay must contain a copy of the sorted aray for second test.
arraynumberofTimes Must contain a copy of the unsorted array for the last test.
araynumberofTimes must contain a copy of the sorted array for the last test.
arraynumberofTimes must contain the TestTimes class that was used to save the measured test times for the sorts performed.
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
