# 5-8) (Find the highest score) Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the name ofthe student with the highest score.SAMPLE RUN #4: java BestStudentStandard OutputHide InvisiblesEnter.the.number.of.students: Student-1.of.6Enter.student's name: Enter student's.score:Student-2.of.6Enter.student s name: Enter.student's.score:Student 3.of-6+Enter.student's name: Enter student's.score:student.4.of.6+Enter student's name: Enter.student's.score:student.5.of.6Enter.student's name: Enter student's.score:Student.6.of.6Enter.student's.name: Enter.student's.score: The highest.score.was. 96.7.and.Thomas Collins got-it

Question
283 views

5-8) (Find the highest score)

Write a program that prompts the user to enter the number of students and each student’s name and score, and finally displays the name of the student with the highest score.

check_circle

Step 1

Java program to find the highest score of the student is as follows:

Step 2

Program:

import java.util.*;

//Declare the class name
public class Main
{
//Main method
publicstaticvoid main(String[] args)
{

//Declare the necessary variables
int n;
String stu_name;
String highest_name = " ";
double stu_score;
double highest_score = 0.0;

//Scanner object for input
Scanner sc = new Scanner (System.in);

//Print the statement
System.out.print("Enter the number of students: ");

//Get the input from the user
n = sc.nextInt();

//Loop to get the number number of students
for(int i = 0; i < n; i++)
{
//Print the statement
System.out.print("Enter student name: ");

//Get the input from the user
stu_name = sc.next();

//Print the statement
System.out.print("Enter student score: ");

//Get the ...

### Want to see the full answer?

See Solution

#### Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in