CS 010 – Intro to Computer Science                                 Fall  -  2003

Assignment 7 – due by 10 p.m. Monday, December 1

 

Course Grade Calculator

Due by 10 p.m. on Monday 12/1, by electronic turn-in

 

You MUST submit your work to the as7 folder corresponding to your lab class, or it will NOT be graded (e.g. if you are in lab class 023, you must submit your work to the folder as7_023). Remember to include your name, SID or SSN (last 4 digits), lecture & lab section numbers, lab login id, & ucr email address in the header of the file you submit (write them as comments).

 

Write a program that will compute the course grade for one student. You must use a structure to hold the student’s id (4 digits), course score, course grade, and all of their individual assignment and test scores. You must use at least 3 functions: one function to input the grades from the input file, scores.txt; at least one function to do the calculations; and one function to output in a nice format all their scores to an output file, grades.txt. Here is a sample input file, scores.txt, and the output file, grades.txt, generated by this program. Your next assignment will be modifying this program, so be sure to follow these guidelines.

 

The assignments/tests and the total points possible for each are as follows:

 

Assignment       Points Possible

HW 1               5                      (can have .5 score so use double type for homework)

HW 2               5

HW 3               5

Quiz 1              10                    (can use int type for the rest of the scores)

Quiz 2              10

Quiz 3              10

Midterm           100

Final                 100

 

To compute the overall course score, use the following grade weights:

 

HW wt:            0.08 (8%)

Quiz wt:            0.15 (15%)

Midterm wt:      0.31 (31%)

Final wt:           0.46 (46%)

 

Here is a formula you can use to calculate the overall course score out of 100 points:

 

hw_norm = (hw1 + hw2 + hw3) / 15 (total hw points possible)

qz_norm = (qz1 + qz2 + qz3) / 30 (total qz points possible)

 

course score = 100 * ( (hw_norm * hw_wt) 

                                 + (qz_norm * qz_wt)

                                 + ((mt / 100) * mt_wt)

                                 + ((fn / 100) * fn_wt) )

 

You can then assign a letter grade based on their course score:

90 – 100 = A     80 – 89 = B     70 – 79 = C      60 – 69 = D     0 – 59 = F