Question: Problem #1 : Min/Max Values in a 1-D Array Write a Java program MinMax that accomplishes the following tasks: 1. Declare and instantiate an array
Problem #1 : Min/Max Values in a 1-D Array Write a Java program MinMax that accomplishes the following tasks: 1. Declare and instantiate an array that will hold 5 double values. 2. Write a loop that will ask the user to enter 5 double values and store them into the array. 3. Print all of the values of the array along with the index associated with that value. 4. Find the minimum value in the array. Print the minimum value and its index. If there is a tie for the minimum value, you only need to print the first index. 5. Find the maximum value in the array. Print the maximum value and its index. If there is a tie for the maximum value, you only need to print the first index. Enter value: 10.2 Enter value; Enter value: 42.7 Enter value: 3.6 Enter value : Here are the values in the array: Index Value 10.2 -5.0 42.7 3.6 -5.0 2 Minimum value: -5.0 at position 1 Maximum value: 42.7 at position 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
