Ok so I'm having trouble with the following loop. The intended goal of this loop is userinput[k] is a list of names that have already been alphabetically sorted in method. These names will then be presented in the InputDialog below, where a number that represents a degree will be entered.
I'm trying to match both the name and degree up. For example: In the loop, the first user input would be userinput[0]. I want the number input to then bee degree[0] and then so on....
The problem is how I store that input with the J incrementor. So the error I'm basically getting is the String degree[] = Integer......
for ( int k = 0; k < userinput.length; k++ ){
for (int j = 0; j < userinput.length; j++ ) {
String input = JOptionPane.showInputDialog("Please enter the highest earned degree for the following person : " + userinput [ k ] + "\n 1 = BS \n 2 = MS \n 3 = PhD");
String degree[] = Integer.parseInt(input[]);
}
}
Is this what you're trying to do?
int[] degree = new int[userInput.length];
for(int k = 0; k < userInput.length; k++) {
String input = JOptionPane.showInputDialog("Please enter the highest earned degree for the following person : " + userinput [ k ] + "\n 1 = BS \n 2 = MS \n 3 = PhD");
degree[k] = Integer.parseInt(input);
}