Question: Design and implement a Java method, named findIndex ( . . . ) , in a separate class ( and separate file ) named IndexOfLargest.
Design and implement a Java method, named findIndex in a separate class and separate file named IndexOfLargest. The method takes a singledimensional array of integer values as a parameter, and it returns the index of the largest value in the array. If the largest value appears more than once, the method returns the smallest index of that value ie index of first occurrence of that value Notice that array indexing in Java starts with Next, write a test program in a separate file, named TestIndexOfLargest, such that the main method asks the user to enter integer values into an array, then call method findIndex in class IndexOfLargest to determine and display the index of the first largest value in the array. Design the main method such that it allows the user to rerun the program with different sets of inputs as in previous assignments, using a sentinel loop Document your code and organize and space the outputs properly using escape characters as shown below. The sample test data below shows only the output labels. Please DO NOT read user inputs as String type. The sample tests below DO NOT show the input prompts, just the outputs. Again, the user may enter all numbers on one line or one per line. Make sure your code displays the outputs following the test data format. First test: You entered these values: Index of largest value: Second test: You entered these values: Index of largest value: Third test: You entered these values: Index of largest value: Fourth test: You entered these values: Index of largest value:
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
