// Input number of students String numStudentsInput = JOptionPane.showInputDialog("Enter the number of students:"); int numStudents = Integer.parseInt(numStudentsInput);
for (int i = 0; i < numStudents; i++) {
String scoreInput = JOptionPane.showInputDialog("Enter the score for student " + (i + 1) + ": "); int score = Integer.parseInt(scoreInput);