Submit | All submissions | Best solutions | Back to list |
AVGJOE - Average Joe |
At the end of a grading period, computer science teacher Joe Schmoe has to calculate grades for his students. Unfortunately, he does not keep a grade book and only has a big list of student names and test scores. Since he is a computer science teacher, he decided to write a program to calculate student averages and assign letter grades according to the following scale:
93+ A
83-92 B
73-82 C
60-72 D
0-59 F
Input
Since Joe teaches multiple classes, the first line of the input file indicates the number of classes. The subsequent lines list the data for each class, one after the other.
Each set of class data begins with a line indicating the number of test scores recorded for the class followed by a separate line for each score listing the student’s first name and their score. Students with multiple scores will appear in the list multiple times.
Output
The program prints a set of output for each class which includes a line indicating the number of students (“X students”) followed by an alphabetized list of student names and letter grades.
Note, when determining letter grades, truncate student averages to integers before looking up corresponding letter grades. For instance, an average of 72.333 truncates to 72 which is a D.
Example
Input: 2 3 James 100 Marc 50 Tim 75 7 Tim 75 Marc 50 James 100 Marc 110 Tim 0 Sparky 5 James 0 Output: 3 students James A Marc F Tim C 4 students James F Marc C Sparky F Tim F
Added by: | BYU Admin |
Date: | 2015-12-15 |
Time limit: | 1s-3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 MAWK BC NCSHARP COFFEE DART FORTH GOSU JS-MONKEY JULIA KTLN OCT PROLOG PYPY3 R RACKET SQLITE SWIFT UNLAMBDA |
Resource: | UIL State 2004 #1 |