Assignment 5
In this assignment, you are asked to write just one program. In this program, you are asked to define and implement a class and then write a program that uses that class.
Write a class that records the highest and lowest temperatures that it has received as input.
MinMaxTemp
.
float
as its argument. This argument represents
the first temperature observation.
AddNewTemp
which also takes a single float
,
representing a new temperature observation, as its argument. A
mutator function is a function that can change the values of the
private member variables.
MinTemp
and MaxTemp
, which return
respectively the minimum and maximum observed temperatures. Inspector
functions can't change the values of the private member variables,
they simply display or return the values of these variables.
Write a driver program which tests your class. The driver program
should open the file temp.txt which contains one floating
point number on each line; these numbers are temperatures. After
opening the file, the driver
program should read the temperatures and use the
MinMaxTemp
class to discover both the smallest and largest
temperture in the file. Before terminating, your driver
program should print the smallest and largest temperatures to the monitor.
A sample input file is provided; the smallest value
in this file is -40 and the largest is 212.
In your solution you should create three files
MinMaxTemp
class (also called the definition of
the class),
main
routine.
The programs written for this assignment must be turned in by transferring the C++ source code files to your ftp directory for this class. Only the files MinMaxTemp.h, MinMaxTemp.cpp and Driver.cpp should be turned in. You were shown how to transfer files to your class ftp directory in lab01, here is a quick repeat.