CS 117 Assignment, Due 9/20/96

A Little Bit of Data Processing

You may work with a partner for this assignment. No groups of three or more, please.

When you are done with this assignment, please submit it using the Homework Submission Program.

The data file data.txt consists of lines of the form

Number Number Number Name

For example,

194 97 164 Mary

Maybe they're miniature golf scores, maybe they're test scores, maybe they're blood test results. Let the numbers mean whatever you want them to mean.

Your task is to write a program that will read each line from the file, and compute the maximum (largest), the minimum (smallest), and the average of the three numbers. So, when you compile the program (gpc -o theProgram theProgram.p or something similar) and run it like this:

theProgram < data.txt

your program should produce an easy-to-read table that looks something like this:

Name        Max   Min   Avg
------------------------------
Mary        194   97   136.33
Bill        182   84   147.67

etc.

Your code should have a modular organization. For example, the retrieval of the input, the reporting of the results, and the computing of the minimum, maximum, and average are five conceptually separate activities, and as such could be placed in five different functions or procedures. (To be fair, the retrieval of the input in this case will consist of a single readln statement, so you don't need to put that in a procedure.)

Your variables should be appropriately named. For example, you might have cause for a variable named average, which is to be preferred to avg, which in turn is preferable to a. Sometimes you get a conflict between names. For example, in this program I would like a variable named average and a function named average. I might resolve this conflict by calling the function ComputeAverage and the variable average.

Make sure to include a comment at the top of your program giving your name, the date, and a brief description of what your program does.

Start early, keep in touch, and have fun.



Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057
(507) 646-4364, jondich@carleton.edu