CS 117 Assignment, Due 1/12/96

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 bowling 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 and run it like this:

theProgram < data

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 average and the variable avg.

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 work soon. Keep in touch. Have fun.



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