80 pts., due May 10
For each program, you should turn in the source code and a print-out
showing a sample run (print the output window). Follow the guidelines in
Section 3.7 for the style of your programs. In addition:
- Use descriptive names for variables and named constants. In
addition, write a brief comment for each variable and named constant
describing how it is used.
- Use uppercase characters for named constants with underscores to
separate ``words.'' Use lowercase characters for variables with either
underscores or capitalization to separate ``words.''
- If a formula you use in a statement isn't obvious, comment it. In
general, comment any non-obvious statement or statement block.
- Your program should be modular (i.e., use several functions). No
function should be longer than a single page.
Documentation will account for 30% of your grade.
Design and implement a simple statistics package. Your program will do the
- Query the user for the name of a disk file to open for reading, and
open the file (repeat until a file is opened). Use the compiler to make
your data file. Name the file grades.txt.
- Data in the file will consist of grades, one per line. Read the
grades from the file into an int array, keeping track of the number
of grades. There will be at most 100 grades (Use a symbolic constant!).
- When finished reading grades, close the input file.
- Sort the grades into ascending order.
- Compute and print the following information:
- The maximum grade.
- The average grade.
- The median grade. (The middle grade from the array of sorted
grades. If there is no one middle grade, i.e., the number of grades is
even, then average the two ``middle'' grades and call the average the
- The number of A's, B's, C's, D's, and F's.
- The standard deviation. Here's the formula:
- Query the user for the name of a disk file to open for writing, and
open the file (repeat until a file is opened). Use the name
- Write the sorted grades from the array to the output file. Close the
output file when finished writing grades. After the file has been written,
you can use the compiler to open and examine the file.
Hand-in your source code, the output from running the program, and copies
of the input and output files.
Thomas P. Kelliher
Wed May 1 08:57:03 EDT 1996