Question: 1 8 . 7 SortDriverGeneric Class You will write the SortDriverGeneric.java class which will implement the SortDriverInterfaceGeneric . The interface may be downloaded from here

18.7 SortDriverGeneric Class
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 main(String[] args) method in SortDriverGeneric.java that performs all of the required tests as specified below.
Method Detail
createArray
java.lang.Integer[](SortDiverInterfaceGenic.,
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[] runSort(SortDriverInterfaceGeneric.SortType 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[0]- must contain a copy of the unsorted array for first test.
array[1]- must contain a copy of the sorted array for first test.
array[2]- Must contain a copy of the unsorted array for second test.
ay[3]- must contain a copy of the sorted aray for second test.
...
array[numberofTimes*2-2]- Must contain a copy of the unsorted array for the last test.
aray[numberofTimes*2-1]- must contain a copy of the sorted array for the last test.
array[numberofTimes*2]- must contain the TestTimes class that was used to save the measured test times for the sorts performed. has to pass 1:Unit tTest SortDriverGeneric.createArray()est
2:Test SortDriverGeneric.runSort()
1 8 . 7 SortDriverGeneric Class You will write

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 Programming Questions!