Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer question 4 9:06 PM Tue Feb 9 @ 81% Class Website Details 1. TestTimes Class You will write the TestTimes.java class which will implement

answer question 4
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
9:06 PM Tue Feb 9 @ 81% Class Website Details 1. TestTimes Class You will write the TestTimes.java class which will implement the Test Timesinterface , The interface may be downloaded from Test TimesInterface.java The Test Times class will contain an array of 10 long values and a counter of how many values have been added using addTestTime (long testTime). Every time a new test time is added, the counter is incremented 2. Linear Search Class You will write the LinearSearch.java class which will inherit from TestTimes.java and implement the Search Interface using a linear search algorithm. The interface may be downloaded from Searchinterface.java Please note that your search method must measure the run time and add it to the TestTimes class by using the addTestTime() method. 3. Binary Search Class You will write the BinarySearch.java class which will inherit from TestTimes.java and implement the Search Interface using a binary search algorithm. The interface may be downloaded from SearchInterface.java Please note that your search method must measure the run time and add it to the TestTimes class by using the addTestTime() method. 4. Driver Class You will write the Driver.java class to test your implementations of: 1. TestTimes.java 2. LinearSearch.java 3. BinarySearch.java The Driver.java will implement the Driver Interface. The interface may be downloaded from DriverInterface java Please note that, in addition to implementing the Driver Interface, you are also required to write your own public static main(String[] args) method in Driver.java that tests all of your classes and methods before submitting your assignment on mimir, public interface TestTimes Interface This interface will be used to organize and manage test times that are measured for specific operations. The user will utilze System.nanoTime() to measure the time it takes to complete an operation. Before the operation is started, you can obtain the start time: startTime = System.nanoTime(). After the operation is completed, you can obtain the end time: endTime = System.nanoTime(). Test Time is then: testTime = endTime - startTime. Author: Sameh A. Fakhouri Method Summary All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void addTestTime(long testTime) This method is used to add a test time. double getAverage TestTime() This method is used to obtain the average test time. long getLastTestTime() This method is used to retrieve the last test time. long get TestTimes) This method returns an array of long values representing the last 10 test times. void resetTestTimes) This method is used to reset all 10 linear search times to zero. public interface Search Interface This is a generalized search interface. You will write two classes that implement this interface: 1. Linear Search 2. BinarySearch Author: Sameh A. Fakhouri Method Summary All Methods Instance Methods Abstract Methods Modifier and Type Method and Description int search(int[] listofnumbers, int target) This method is used for searching for a target value in an array representing a listOfNumbers. Method Detail search int search(int[] listOfNumbers, int target) This method is used for searching for a target value in an array representing a listOfNumbers. Parameters: listOfNumbers - An array of int values. target - An int value representing the target we are searching for. Returns: If the target value is found, the method will return the index of the target value in the listOfNumbers. Otherwise, the method will return -1. public interface Driver Interface These are the methods that you will use to exercise your Linear Search.java and BinarySearch classes. Author: Sameh A. Fakhouri Method Summary All Methods Instance Methods Abstract Methods Modifier and Type Method and Description int (1) getListof Numbers() This method will generate and return a sorted array of int values starting at 1 and ending at 10,000,000. int( getTargets() This method will return an int array containing the following values: 500 10,000 100,000 1,000,000 5,000,000 7,500,000 10,000,000 TestTimes runBinarySearch(int[] listOfNumbers, int target, int numberOfTimes) This method should create an instance of the BinarySearch.java class and run the search for the specified target in the listOfNumbers a total of numberOfTimes. TestTimes runLinear Search(int[] listOfNumbers, int target, int numberOfTimes) This method should create an instance of the LinearSearch.java class and run the search for the specified target in the listOfNumbers a total of numberOfTimes

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

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

DEFINE human resources planning (HRP) and

Answered: 1 week ago

Question

Strong analytical, communication, and problem-solving skills

Answered: 1 week ago