What I'm trying to do is get a set of numbers from the user, the console will print out the second highest number in english and the second lowest number in spanish.
First I'm trying to get the input from user, put it in an array and grab the second highest and second lowest value of the components. But I can't figure out how to grab ones I need.
public static void main(String[] args) {
//get the length from user
int length;
Scanner input = new Scanner(System.in);
System.out.println("How many variables are you going to enter?: ");
length = input.nextInt();
//allocate array for that length
int[] variables = new int[length];
for(int counter = 0; counter < length; counter++) {
System.out.println("Enter variable: ");
variables[counter] = input.nextInt();
}
input.close();
//print the variables
System.out.println("Your variables are");
for(int counter = 0; counter < length; counter++) {
System.out.println(variables[counter]);
}
}