CIS 1.5

Brooklyn College

Professor Langsam

 

Assignment #3

 

Write a complete C++ program for the following problem. Your instructor needs a program that will calculate student semester averages, final letter grades as well as the class average and the distribution of letter grades. A data file, StudentGrades.txt, has been prepared containing the student’s name, and three test scores, test1, test2 and finalTest.

 

The program will do the following:

 

  1. The main function will read a student’s record from the file and call a function, computeAverage which will compute and return the student’s average using the following formula:

 

semesterAverage = 0.20 * test1 + 0.30 * test2 + 0.50 * finalTest

 

  1. The main program will then invoke a function, letterGrade, which will return the student’s letter grade according to the following scheme:

 

Semester Average                   Final Letter Grade

>= 90                                          A

>= 80                                          B

>= 70                                          C

>= 60                                          D

   <60                                          F

 

  1. The main program will then invoke a function, printRecord, which will print a student’s record.

 

  1. The main program will tabulate the grade distribution, class average, and the highest and lowest semester grade.

 

Your program must determine when there are no more student’s to process. Explain your method in a comment. Write all output to a file called Roster.txt. Your output should contain headings and be neatly formatted. Use the following data:

 

Meredith  85   90   85

Bailey    70   90   70

Izzie     45   50   65

George    75   80   72

Cristina  72   78   78

Gibbs     92   98   95

Denozzo   70   70   70

Ziva      90   88   95

McGee     88   88   88

Abby      50   65   65

 

Be sure to use meaningful variables, avoid the use of global variables and format your program using the style we have adopted in class.