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
Asked Mar 11, 2019
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.

 

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.
SAMPLE RUN #4: java BestStudent
Standard Output
Hide Invisibles
Enter.the.number.of.students: Student-1.of.6
Enter.student's name: Enter student's.score:Student-2.of.6
Enter.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.6
Enter.student's name: Enter student's.score:Student.6.of.6
Enter.student's.name: Enter.student's.score: The highest.score.was. 96.7.and.Thomas Collins got-it
help_outline

Image Transcriptionclose

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. SAMPLE RUN #4: java BestStudent Standard Output Hide Invisibles Enter.the.number.of.students: Student-1.of.6 Enter.student's name: Enter student's.score:Student-2.of.6 Enter.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.6 Enter.student's name: Enter student's.score:Student.6.of.6 Enter.student's.name: Enter.student's.score: The highest.score.was. 96.7.and.Thomas Collins got-it

fullscreen
check_circle

Expert Answer

Step 1

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

Step 2

Program:

//Import necessary header files
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

Check out a sample Q&A here.

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.

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: how to write a function that takes an integer n and prints all of the integers between 1 and n which...

A: Since no programming language is specified we choose python as it is one of most popular programming...

question_answer

Q: in Operating System1.Why are two modes (user and kernel) needed?2.What are the steps performed by an...

A: Reasons why two modes are needed in OS:The two modes of OS are user mode and kernel mode. The user m...

question_answer

Q: getRandomLib.h: // This library provides a few helpful functions to return random values// * getRand...

A: Program Instructions:Include the necessary header files.Print hello message and as for a response.De...

question_answer

Q: 5-18) (Display four patterns using loops) Ask the user to enter an integer toset a limit for nested ...

A: The algorithm would run into 4 sections for each pattern. For patterns A and C each line will have i...

question_answer

Q: Develop the ‘Shape’ application such that: ‘Rectangle’, ‘Ellipse’, and ‘Triangle’ classes inherit f...

A: Program plan:Define a class named “Shape”.Define a default constructor to print constructor invoked ...

question_answer

Q: Hi,please I need to use Python for the following: Use for loop to do the following: 1) print the num...

A: Program instructions:Use range() in for loop to print the numbers.Function range() has here argument...

question_answer

Q: I am struggling on storing numbers from the getChoice () function into an array and pulling it back ...

A: Click to see the answer

question_answer

Q: Question 2 3 4

A: Question 2:Given binary value = 11012   The given binary value does not represents the decimal numbe...

question_answer

Q: How to write a function in python where it takes a list of string s. Where s= ["hello","lazyness","p...

A: The program has the following algorithm:Intitialize the counter counting string list position number...