We must create a program that do the following:
Allow the user to type in a student name the coorosponds with the student's exam score.
The program will be able to accpet exam scores till the user types in the phrase "allDone".
The code will determine which student has the highest score and give the name and the score to the user.
Here is an example of what will be shown in the console....
Sample Input
Bob 82
Mary 90
James 87
alldone
Sample Output
Mary has the highest score. Her score is: 90.
This line of code allows the user to type in the name of student and the grade that goes with the name:
//Allows for name and score to be type into system.
for(count = 0; count < numberOfStudents; count++)
{
//Prompts user to type name of student.
System.out.println("Type in the name of student " + count + ":");
//Allows name of student to be stored in array.
studentName [count] = input.nextLine();
//Prompts user to type grade of student.
System.out.println("Type in the score of student " + count + ": ");
//Allows grade of student to be assigned in array.
studentScore [count] = input.nextDouble();
}
I get an error message when I used this code. My question is this: In other words, how do I reformat this piece of code to allow the user to type in a name seporataly along with the corrospoindng exame score?