CSCI 297 Assignment A

Mean and Standard Deviation

In statistics, we often have a collection of numbers, and there are various calculations we can make, including the mean and the standard deviation.

In this assignment, we have a file containing several lists of numbers, and we will investigate each list of numbers.

You may find that a good way to start on this is to read the algorithm and figure out what parts repeat, that is, what loops are needed. Decide what variables you need.

To calculate the statistics we want will require a loop. We will have several lists of numbers, so we will need another loop as well.

The actual calculation is described here.


What does the data look like?

Each line of data contains one integer.

Copy the data file into your directory. You can find it here.

The lines are actually organized into groups. Each group is a list of numbers, followed by a line containing the value -555.00. Here -555.00 is a delimiter marking the end of the group. Do not include -555.00 in the calculations.

At the end of the whole file is a line containing -444.00. It is a delimiter indicating the end of the file.

There are also other ways to find the end of the file.


Steps:

  1. The algorithm reads one input value X from each line until it find the delimiter value -555.00.

  2. First write the program to process one list of nunbers.

  3. Once it is working for one list of numbers, modify it to handle several lists of numbers. This will involve having a loop which ends when we find the value -444.00. Thus we will have a loop inside a loop. Each loop begins with "DO WHILE" and ends with "END DO". (The are known as nested loops.)

  4. We are going to use input redirection, so you do not need lines which ask the user to enter the data.

  5. Print out each number in the input after you read it.

  6. Your program should use a minimum number of variables to do the job. It should be efficient and well-structured. Include the line IMPLICIT NONE in the specification part of your program.

  7. We have a web page on loops.

  8. To make the output easier to read, skip two blank lines using
             PRINT *
             PRINT *
    between groups of input values.

  9. Compile and link the program as in the previous assignments.

  10. After you obtain a copy of the input file, run your program with input and output redirection:
              progA < dataA.txt > outputA.txt

    The program will read its input from dataA.txt and write its output to outputA.txt.