Code Wars V
     

Program / Task Name:

   What's Your Average?

Level:

 

 Intermediate

Point Value:

 

 7

 

Task Description

Suzy Schoolteacher has always tried to be as fair as possible when judging her students at the end of the year.  She will drop the lowest (only one) homework grade from each student’s list of homework grades.  In the case of Alex Smith, she would drop the 68 because it is his lowest homework grade.

Create a grade-book program that reads in all the students’ names and grades, and then computes their final averages using Suzy’s grading techniques.  Homework grades are preceded by an ‘H’ and test grades are preceded by a ‘T’.

  • The number of students and the number of grades is undetermined (but will not exceed 50).

  • All students will have the same number of grades.

  • A student’s final grade is 60% of his/her test average and 40% of his/her homework average.

  • Round all final grades to the nearest tenth (83.65 would round to 83.7).

Program Input

The grades for the grade book can be found in prob08.in and will look as follows:

 

11 5
Alex Smith H 75 88 94 95 84 68 91 74 100 82 93 T 73 82 81 92 85
Susan Wright H 86 55 96 78 93 85 80 74 76 82 62 T 82 89 93 70 74
John Jones H 84 66 74 98 92 85 100 95 96 42 88 T 88 94 100 82 95
Jane Doe H 73 99 98 83 85 92 100 60 74 98 92 T 84 96 79 91 95
Jimmy Johnson H 65 72 78 80 82 74 76 0 85 75 76 T 74 79 70 83 78

Program Output

Write the averages for each student into prob08.out as follows:

Averages
Alex Smith 84.6
Susan Wright 81.4
John Jones 90.2
Jane Doe 89.2
Jimmy Johnson 76.6

 

hp Code Wars
Hello -- Dominos?...
   
  (c) 2004 Hewlett-Packard Company