CMSC 104
Sections 103/105/401
Programming Project Four

Random Grades

Assigned: Tuesday 5/4/99
Due: Before Midnight Friday 5/14/99

The Objective

The purpose of this project is to give you practice with arrays and the 'for' loops that are almost always used with them.  You will also be passing an array to a function and getting practice with formatted output.

The Background

As an experiment, I have decided to determine the grade distribution in CMSC 104 by randomly generating exam scores. Final letter grades will be calculated from 3 exams and assigned the usual letter. Your job is to randomly generate the exam scores and perform some analysis of the scores and letter grades.

The Task

Your task is to write a program that randomly generates 3 exam grades for 20 CMSC 104 students. Because CMSC 104 students study hard and pay close attention in class, no student could possibly receive a score less than 45 on any exam. Therefore, you should generate exam scores between 45 and 100, inclusive.
When all exam scores are generated, you must calculate the semester average for each student.  Then, assign a letter grade to each student according to the usual scale Your program should then analyze the letter grades and count the number of A's, B's, etc.

To insure that all projects get the same results, you must observe the following guidelines:

  1. Your program must prompt the user for a positive integer that is used to seed the random number generator. Use the seed in the sample run below to test your code. You should get exactly the same output.

  2. You may (wisely) choose to use the function GetPostiveInteger() from project 3
  3. You must generate all scores for exam1, then all scores for exam2, then all scores for the final exam

  4. This requirement highly suggests the use of a function to generate the scores.

Program Requirements

  1. Your program must use arrays where appropriate. You will need at least 3 arrays (for the exam scores) and may use more
  2. Your program must have at least one function that takes an array as a parameter (see guidelines above for a big hint).
  3. Your program must ask the user for a positive random number generator seed
  4. Your program's output must contain all information shown below.  You may provide another format if you wish, but it must be neatly aligned and contain all data.
  5. Your program must be named proj4.c

Sample Output

retriever[102] a.out Please enter a positive random number seed: 555 Student Exam1 Exam2 Final Average Grade 1 97 87 85 89.67 B 2 45 92 62 66.33 D 3 57 79 59 65.00 D 4 95 48 60 67.67 D 5 79 66 47 64.00 D 6 94 91 92 92.33 A 7 45 90 63 66.00 D 8 61 95 92 82.67 B 9 46 97 58 67.00 D 10 64 89 90 81.00 B 11 54 60 73 62.33 D 12 99 54 60 71.00 C 13 73 66 79 72.67 C 14 76 45 58 59.67 F 15 81 72 65 72.67 C 16 54 88 71 71.00 C 17 51 84 90 75.00 C 18 84 46 54 61.33 D 19 89 60 83 77.33 C 20 68 57 71 65.33 D Grade Distribution: A: 1 B: 3 C: 6 D: 9 F: 1 retriever[104]

10-Point Extra Credit

Before beginning the extra credit portion of this project, it would be in your own best interest to complete and submit the required program first.

Many times students ask about "curving" grades. While I do not "curve" grades, I do sometimes round grades to the next highest integer score. For a 10-point bonus, enhance your program to do the following

Extra Credit Sample Output

retriever[103] a.out Please enter a positve random number seed: 555 Student Exam1 Exam2 Final Average Grade RoundedAve Grade 1 97 87 85 89.67 B 90.00 A ** 2 45 92 62 66.33 D 66.00 D 3 57 79 59 65.00 D 65.00 D 4 95 48 60 67.67 D 68.00 D 5 79 66 47 64.00 D 64.00 D 6 94 91 92 92.33 A 92.00 A 7 45 90 63 66.00 D 66.00 D 8 61 95 92 82.67 B 83.00 B 9 46 97 58 67.00 D 67.00 D 10 64 89 90 81.00 B 81.00 B 11 54 60 73 62.33 D 62.00 D 12 99 54 60 71.00 C 71.00 C 13 73 66 79 72.67 C 73.00 C 14 76 45 58 59.67 F 60.00 D ** 15 81 72 65 72.67 C 73.00 C 16 54 88 71 71.00 C 71.00 C 17 51 84 90 75.00 C 75.00 C 18 84 46 54 61.33 D 61.00 D 19 89 60 83 77.33 C 77.00 C 20 68 57 71 65.33 D 65.00 D Grade Distribution: Rounded Grades A: 1 2 B: 3 2 C: 6 6 D: 9 10 F: 1 0

Submitting Your Program

Submit your program in the usual way.  At the Unix command, type

submit cs104-103 proj4 proj4.c

To verify that your program was submitted successfully, use the command

submitls cs104-103 proj4