Lab 5 Solution

$30.00 $24.00

Lab Instructions: The file lab5data.txt holds the names and grades for the students in a math class. Your program will calculate and display the average for each student, as well as their highest grade, and calculate and display the average for the whole class, as well as the highest grade. The number of grades for…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

Lab Instructions:

The file lab5data.txt holds the names and grades for the students in a math class. Your program will calculate and display the average for each student, as well as their highest grade, and calculate and display the average for the whole class, as well as the highest grade.

  • The number of grades for each student is unknown.
  • The last ‘grade’ for each student will be -1, which is not an actual grade.
  • The number of students is unknown. You must keep reading in student data until there is no more
  • The class average is the average of the student’s averages.
  • If a student has no grades (except for the -1), their average is 0.
  • If there are no students in the class, the class average is 0.

Hint: You should not try to read in all the data from the file before doing any calculations or output. Much of it can be done one student at a time.

For example, if the data file contains the following data:

Sue Storm 95 76 89.3 99.2 91 -1

Reed Richards 76 85.5 89.25 -1

Bruce Banner 54.5 67.8 75 88.3 -1

The output will look like this:

Lab 5 Solution
$30.00 $24.00