Question: Create an ExperimentController class. The class will have the following methods: a. timeAddToFront( int numberOfItems, int seed, int min, int max): i. create an instance

Create an ExperimentController class. The class will have the following methods:

a. timeAddToFront( int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToFront() method.

iii. The method will return the time taken to add all the items to the container using addToFront().

b. timeAddToBack( int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.

iii. The method will return the time taken to add all the items to the container using addToBack().

c. timeAddSorted( int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addSorted() method.

iii. The method will return the time taken to add all the items to the container using addSorted().

d. timeProductdSorted( int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, prepend random even numbers between min and max to the first element of the container using the productSorted() method.

iii. The method will return the time taken to add all the items to the container using productSorted().

e. timeSortofUnsortedList(int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.

iii. The method will call selectionSort().

iv. The method will return the time it took to sort the array.

f. timeSortOfSortedList(int numberOfItems, int seed, int min, int max):

i. create an instance of a RandomIntegerContainer

ii. for the specified numberOfItems, insert random even numbers between min and max to the container using the addToBack() method.

iii. The method will call selectionSort().

iv. The method will call selectionSort() again.

v. The method will return the time it took to sort the already sorted array.

Create an ExperimentController class. The class will have the following methods: a.

import static org.junit. Assert. assertArrayEquals; import java.util.*; import org.junit. Test; public class Random IntegerContainer { private ArrayList arraylist; public Random IntegerContainer() { arraylist = new ArrayList(); public void addToFront(int x) { arraylist.add(0, x); public void addToBack(int x) { arraylist.add(x); public void addSorted(int x) { arraylist.add(x); selectionSort(); public void productsorted(int x) { int first = arraylist.remove(); arraylist.add(0, first * x); selectionSort(); public void selection Sort() { for (int i = 0; i arraylist; public Random IntegerContainer() { arraylist = new ArrayList(); public void addToFront(int x) { arraylist.add(0, x); public void addToBack(int x) { arraylist.add(x); public void addSorted(int x) { arraylist.add(x); selectionSort(); public void productsorted(int x) { int first = arraylist.remove(); arraylist.add(0, first * x); selectionSort(); public void selection Sort() { for (int i = 0; i

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