Assignment 7 - Student Grades Using Functions

due November 11th

The purpose of this assignment is to give you practice reading and writing text files, using functions, and program planning.

This program is a modification of assignment 6.  In this assignment you are required to write (and use) at least 4 functions in addition to main.  

Part 1 Detail

Read in the student data file, partially shown below. This 50 record file consists of a (8-digit numeric) student id, 11 assignment's points, midterm points, final points and lab exercise points. You must again follow the rules from assignment 4 to determine the letter grade. In this assignment, you will process 50 student grades. CodeLab points are not applicable for this assignment.  You will write the input student data and the results of the processing into a student report file that looks like the output shown below. In addition to the input student data, the report should contain the "total" of the assignment grades, the total and percent of all points achieved, and the letter grade.  You may assume that the input data file does not contain any errant data.

You should use at least 4 functions for this part of the assignment.

The Student Data Input File

40680213  8 19 19 20 18 19 19 19 20  3 19  40  48 32
70750273  4 18  7 19 18  9 18 19 20  6 20  41   7 47
36331632 19 20 11 20 19 17  6 18 19 12 20  34  62 48
70671155  8 19  7 20 18 19 20 20 20 19 20  40  86 29
69730920 15 19 19 20 17 12 19 19 20  4 19  38  11 47
15535274  5 17  4 19 20 10  9 19 20 16 18  50  81 40
76397884 19 20 19 20 19  5 19 19 19  8 20  44  60 40
90034920  4 19 14 20 19 19 11 17 20 19 17  33   8 44
07065286  7 20 19 20 17  7 19 17 20 19 19  38  14 42
21869937 12 20  9 19 17  1  7 19 20 15 17  35  69 48
14733180 19 19  2 20 19 17 13 20 19 11 20  48  22 29
01638880  1 19  8 20 18 19  5 20 20 19 17  33  42 37

...

The Student Report Output File

Student   -----   Assignment Grades  -----  Ass  Mid  Fin LEx Total  Pct Gr
--------  -- -- -- -- -- -- -- -- -- -- --  ---  ---  --- --- -----  --- --
40680213   8 19 19 20 18 19 19 19 20  3 19  180   40   48  32   300   75 C
70750273   4 18  7 19 18  9 18 19 20  6 20  154   41    7  47   249   62 D
36331632  19 20 11 20 19 17  6 18 19 12 20  175   34   62  48   319   80 B-
70671155   8 19  7 20 18 19 20 20 20 19 20  183   40   86  29   338   85 B
69730920  15 19 19 20 17 12 19 19 20  4 19  179   38   11  47   275   69 D+
15535274   5 17  4 19 20 10  9 19 20 16 18  153   50   81  40   324   81 B-
76397884  19 20 19 20 19  5 19 19 19  8 20  182   44   60  40   326   82 B
90034920   4 19 14 20 19 19 11 17 20 19 17  175   33    8  44   260   65 D
07065286   7 20 19 20 17  7 19 17 20 19 19  177   38   14  42   271   68 D+
21869937  12 20  9 19 17  1  7 19 20 15 17  155   35   69  48   307   77 C
14733180  19 19  2 20 19 17 13 20 19 11 20  177   48   22  29   276   69 D+
01638880   1 19  8 20 18 19  5 20 20 19 17  165   33   42  37   277   69 D+

...

Part 2 Detail

Modifiy part 1 of the assignment to include necessary processing to determine

The Student Summary Output File

Make sure you write this output to a file and that you use the exact format for output.  You should use a separate function to write out the part 2 output.


Number of students = 53
The average total points = 299.1
The average percent total = ??.?%                       <== Exact number not displayed
Highest grade: Id=27029673  Points=???  Percent=??.0%
  <== Exact numbers not displayed
Lowest grade: Id=423?????  Points=??0  Percent=??.5%    <== Exact numbers not displayed

Additional requirements

  1. All files must be checked for a successful open.
  2. Make sure you write the student id with a leading 0, if appropriate.
  3. Add headings to your output report file. They should be aligned and correctly identify the column data.
  4. Do not use global variables, except for constants, in your solution.