C.I.S. 1.50

Brooklyn College

Professor Langsam

 

Program #4

 

 

You have the following data file:

 

            23        35        35        40        21

            29        35        34        43        33

            42        42        45        35        35

            34        28        29        24        36

            37        38        46        49        51

 

These numbers represent mean temperatures, arraigned by week, with the first column being Monday's mean, the second Tuesday's, ¼, and the fifth Friday's.

 

Write a program to input the lines one at a time. You are to print each line of data, followed by the highest mean for the week, the lowest mean, and the mean of the means (to one decimal point). You must write three different functions to compute these three figures. You should also write a function that will enable you to print the word ‘yes’ if the mean temperature was the same on any two consecutive days in the week and ‘no’ if it was not. This function must be invoked to print the ‘yes’ or ‘no’ at the end of each line.

 

After skipping a few lines, print a final message giving the number of weeks which were processed, and a final message giving the highest mean of all and the day and week in which it occurred.

 

Provide headings, and make sure that the output for each week appears on a single line. Remember to provide comments, at the beginning of the program and at the top of each function. Check you results. Eliminate, whenever possible the use of external variables, by declaring appropriate parameters and local variables. Submit your source program, your output, and a copy of the data file.