System Temperature Calculation Problem

We are going to simulate a small utility program that records the temperature inside the computer box. Each minute, the temperature is taken and stored in a file. Our program will read this file and calculate the highest, lowest and average temperature. The report on the analysis will be written to another file. It will also be printed to the screen.

We will read from the file until it is empty.

Inputs

Input will consist of a file of temperatures in Celsius. The filename will be passed via the command line

Outputs

Write the highest, lowest and average temperatures to a file as well as the screen. The filename will be passed via the command line

Notes

Here is some sample output, note that there are error messages if the number of arguments is wrong.
--> ./filetemps
Usage: filetemps infilename outfilename
--> ./filetemps tdata.txt
Usage: filetemps infilename outfilename
--> ./filetemps tdata.txt tdataout.txt
There were = 10 data points
minimum temp = 12
maximum temp = 76
sum temp = 325
avg temp = 32.5
--> cat tdataout.txt
There were = 10 data points
minimum temp = 12
maximum temp = 76
sum temp = 325
avg temp = 32.5
-->

Answer

Here is one solution to this problem.