#C12752. Student Records Analysis
Student Records Analysis
Student Records Analysis
You are given several student records from standard input. Each record is given on a separate line and has the following format:
Name, ID, Grade1, Grade2, ... , GradeN
The task is to compute the average grade for each student and then output each student's name along with their average grade. The average should be computed using the formula:
$$ \text{average} = \frac{\sum_{i=1}^{n}\text{grade}_i}{n} $$
After printing all student averages (formatted to two decimal points) on separate lines in the format:
Name: average
print one additional line indicating the student with the highest average grade. This line should be in the following format:
Student with the highest average grade: Name
If there is a tie, choose the first student encountered with the highest average.
inputFormat
The input consists of several lines read from standard input. Each line represents a student record in the format:
Name, ID, Grade1, Grade2, ... , GradeN
There is no explicit number given for how many records are provided; you should process until the end of input. There will be at least one record.
outputFormat
For each student record, print a line in the format:
Name: average
where average is the student's average grade displayed with two decimal places. At the end, print a line:
Student with the highest average grade: Name
where Name is the name of the student having the highest average grade. If multiple students have the same highest average, choose the one that appears first in the input.
## sampleJohn Doe, 21, 90, 85, 92
Jane Smith, 22, 88, 79, 85
Alice Johnson, 23, 95, 92, 98
John Doe: 89.00
Jane Smith: 84.00
Alice Johnson: 95.00
Student with the highest average grade: Alice Johnson
</p>