Homework 10, More Data Processing (16 points)
This is a variation on your last homework
The program pttest.f is designed to read in arrays of temperature and pressure data, and output the average,
minimum and maximum values for temperature and for pressure. It needs a little work before it will
function. Add the following programming:
Test this program with the old data file props.data and check against your last set of results. Next test
against the file pt.data. If your MASK arguments are working properly, the answers will be the same.
- In the subroutine input add a prompt for the name of the file containing data: "File containing
Temperature and Pressure data:". Arrange this prompt so that the user's answer is on the same
line. Next check that a file with that name exists. If it does exist print "filename being processed",
where filename is the actual filename provided by the user. Include only one space between the
filename and the word "being". If the file does not exist, print: "filename not found" and stop the
program. Again filename is the actual filename provided by the user. Your output should have only
one space between the filename and the word "not".
- In subroutine "input", add a line or two to allocate the space for the temperature and pressure
- Add the necessary subroutine named "stats" to obtain average, minimum and maximum values.
This time use the intrinsic functions SUM, COUNT, MINVAL, and MAXVAL to do most of this
work, and include the optional "MASK=" arguments to exclude from your calculation any data
values less than or equal to zero.
This homework will be graded as follows:
- 2 points for quality of comments
- 1 point for proper use of ADVANCE='NO' in item 1 above.
- 1 points for input of the file name into the variable "filename" in item 1
- 2 points for good IF,THEN, ELSE logic in item 1
- 2 points for output with proper file name and requested spacing in item 1
- 2 points for proper form of subroutine stats
- 3 points for proper basic use of SUM, MINVAL, and MAXVAL
- 3 points for correct use of the optional "MASK=" argument
Bonus: If you had problems with Homework 4, or didn't turn it in you can ask your TA to
grade your use of SUM, MINVAL, and MAXVAL on a 0-4 point scale to replace the old
Homework 4 grade.
Leave your modified version of pttest.f (don't change the file name) in your "homework"
subdirectory. We will pick it up after the due date and test it.
Maintained by John Mahaffy : email@example.com