#C5639. Student Grade Calculator
Student Grade Calculator
Student Grade Calculator
You are given a list of students along with their scores in three subjects: mathematics, science, and literature. Your task is to calculate the average of these scores and assign each student a grade based on the following criteria:
- If \(\text{average} \geq 90\), then grade = 'A'
- If \(80 \leq \text{average} < 90\), then grade = 'B'
- If \(70 \leq \text{average} < 80\), then grade = 'C'
- If \(60 \leq \text{average} < 70\), then grade = 'D'
- Otherwise, grade = 'F'
You need to read the input from standard input (stdin) and print the result to standard output (stdout).
inputFormat
The first line contains an integer \(T\) representing the number of students. Each of the following \(T\) lines contains a student record with a string representing the student's name (without spaces) followed by three integers representing the scores in mathematics, science, and literature.
Example:
5 Alice 85 90 88 Bob 78 74 80 Charlie 65 60 58 David 92 95 93 Eva 55 60 50
outputFormat
For each student, output a line containing the student's name and the corresponding grade separated by a space.
Example:
Alice B Bob C Charlie D David A Eva F## sample
5
Alice 85 90 88
Bob 78 74 80
Charlie 65 60 58
David 92 95 93
Eva 55 60 50
Alice B
Bob C
Charlie D
David A
Eva F
</p>