Question: Design and implement a Java method (name it findIndex) in a separate class (name it IndexOfLargest). The method takes a single-dimensional array of integer values

Design and implement a Java method (name it findIndex) in a separate class (name it IndexOfLargest). The method takes a single-dimensional array of integer values as a parameter and 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. Notice array indexing in Java starts with 0. Next, write a test program in a separate file (name it TestIndexOfLargest) such that the main method asks the user to enter 10 integer values into an array, then call method findIndex in class IndexOfLargest to determine and display the index of the largest value in the array. Design the main method such that it allows the user to re-run 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 in the following sample outputs:

Entered integer values: 15 23 -13 12 11 90 25 -17 51 90 Index of largest value: 5

Entered integer values: 5678 123 -113 12 211 -500 2578 17 51 100 Index of largest value: 0

Entered integer values: -15 -3 -13 -62 -11 -51 -125 -117 -5 -10 Index of largest value: 1

Entered integer values: 125 -3 -13 -62 -11 541 -125 -117 555 1300 Index of largest value: 9

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!