This is the specific requirements for the assignment:
"First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ==> Close All Projects).
Then create a new Java application called "MinMax" (without the quotation marks) that declares an array of doubles of length 5, and uses methods to populate the array with user input from the command line and to print out the max (highest) and min (lowest) values in the array. The methods that determine the max and min values may not use any built-in sort methods in Java. That is, you need to write the appropriate logic in those methods.
NOTE: For this assignment and all future assignments that deal with methods, you should be calling the appropriate method to do the task indicated, rather than implementing the task logic in the main method itself."
Specifically, I'm having trouble converting the int arrays in the getMin and getMax methods to the double array in the main method.
package minmax;
import java.util.Scanner;
public class MinMax {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
double[] userVals = new double[5];
double userNumbers;
System.out.print("Enter 5 numbers: ");
userNumbers = scnr.nextDouble();
System.out.print("Minimum number: ");
}
public static int getMin(int[] array) {
int minNum = array[0];
for (int i = 0; i < array.length; ++i) {
if (array[i] < minNum) {
minNum = array[i];
}
}
return minNum;
}
public static int getMax(int[] array) {
int maxNum = array[0];
for (int i = 0; i < array.length; ++i) {
if (array[i] > maxNum) {
maxNum = array[i];
}
}
return maxNum;
}
}
I'm trying to print out both the min. and max. of the 5 user numbers. I know that my code is incomplete in the main method, but that's due to not knowing how to convert int arrays to double arrays.