CSC 7000-002 Algorithms & Programming
Fall 1999, Mendel 115
Dr. David Matuszek
A statistics professor likes to assign grades on the basis of Z-scores, according to the following table:
| Z-score | Grade |
|---|---|
| 1 <= score | A |
| 0.5 <= score < 1 | B |
| -0.5 <= score < 0.5 | C |
| -1 <= score < -0.5 | D |
| score < -1 | F |
She wants you to write a program to take the raw (unprocessed) scores for her students, which will be in the range zero to 100, and convert them to Z-scores. To test your program, since you don't have access to the actual grades, write a function to generate ("make up") some data. For the names of your students, just use numbers: if the class has 25 students, number them 1 to 25.
Here are the specifics of the functions you are to write:
int generate_raw_score (void)double mean (int raw_score[], int count)double standard_deviation (int[] raw_score, int count, double mean)double z_score (int raw_score, double mean, double stdev)char letter_grade (double z_score)void print_grades (int raw_score[], int count)Your program and all your functions should be documented with comments. Arrange your program so that it doesn't do redundant computations; for example, you should compute the mean only once. Try to avoid creating another array to hold Z-scores.
The purpose of this assignment is to familiarize you with writing and using functions.
Alternate assignment: Write a program that uses three or more
functions that you define. At least one of your functions should return void,
at least one should return an actual value, at least one should take no parameters, and at
least one should take (and use) one or more parameters. Use comments to document your
program, including all your functions. If appropriate, try to use at least one function
from <math.h>.
* Thanks and 5 points to Rusong Wang for discovering this error.