I have to create a program that takes a list of student names and grades and then takes the 2 highest scores and reads them, but the result won't show. I'm pretty sure it's because I'm not sure about how to code the last part which should output the results. Here's my code. Help please and thank you.
import java.util.Scanner; //Reads input and outputs 2 highest scores //for loop. nested for. public class HighestScores { public static void main(String[] args) { //create values String studentName; String student1 = null; String student2 = null; double studentScore = 0.0; double highestScore = 0.0; double secondHighest = 0.0; int numberStudents = 0; //How many students in class //User inputs for loop Scanner input = new Scanner(System.in); System.out.print("Enter number of students in class: "); numberStudents = input.nextInt(); //do-while loop w/ number of students -- to go down to 0 do { System.out.print("Enter student's name: "); studentName = input.next(); System.out.print("Enter student's grade: "); studentScore = input.nextDouble(); numberStudents--; } while (numberStudents != 0); //Find the 2 highest scores if (highestScore > 90) { System.out.println("The highest grade is " + highestScore + " by" + student1); } if (secondHighest < highestScore && secondHighest > 90) { System.out.println("The second highest grade is " + secondHighest + " by" + student2); } } }