#K47567. Student Grades Analysis
Student Grades Analysis
Student Grades Analysis
A university needs to process and analyze student grades for its courses. For each course, you are required to determine the highest, lowest, and average scores. In addition, you must calculate the overall highest, lowest, and average scores across all courses. The average is computed using the formula: \(\text{Average} = \frac{\sum_{i=1}^{n}{\text{score}_i}}{n}\), where \(n\) is the number of scores.
The input will be read from stdin and the output should be written to stdout as described.
inputFormat
The input consists of multiple lines. Each line contains a record in the following format:
<course_name> <student_name> <grade>
where course_name
and student_name
are strings without spaces, and grade
is a non-negative integer not exceeding 100. Input is terminated by a line containing END
. There will be at least one record (thus, at least one output line) in each test case.
outputFormat
For each course (sorted in alphabetical order), output a line in the following format:
<course_name>: Highest: <highest_score>, Lowest: <lowest_score>, Average: <average_score>
The average should be printed with two decimals. After listing all courses, output an additional line for the overall statistics in this format:
Overall: Highest: <highest_score>, Lowest: <lowest_score>, Average: <average_score>
If no valid record is provided before the termination line, nothing should be output.
## sampleMath Alice 78
Math Bob 92
Science Alice 85
Science Bob 90
Math Charlie 88
Art Alice 95
END
Art: Highest: 95, Lowest: 95, Average: 95.00
Math: Highest: 92, Lowest: 78, Average: 86.00
Science: Highest: 90, Lowest: 85, Average: 87.50
Overall: Highest: 95, Lowest: 78, Average: 88.00
</p>