Assignment 5 for CSCI 201

Description:

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.

Program 1:

(worth 25 points)

Write a class that records the high and low temperatures.

  1. The class should be called MinMaxTemp.
  2. The class should have a single constructor which takes a single float as its argument. This argument represents the first temperature observation.
  3. The class should have a single mutator AddNewTemp which also takes a single float, representing a new temperature observation, as its argument.
  4. The class has two inspectors, MinTemp and MaxTemp, which return respectively the minimum and maximum observed temperatures.

Write a driver program which tests your class. The driver program should open the file temp.dat which contains one floating point number on each line. After all the numbers have been read, your driver program should print the smallest and largest temperatures it has read. A sample input file is available through this link. The smallest value in this file is -40 and a largest is 212.

In your solution you should create three files

  1. MinMaxT.h, which gives the interface to the MinMaxTemp class (also called the definition of the class),
  2. MinMaxT.cpp, which gives the implementation of the class, and
  3. Driver.cpp, which contains your driver program and consequently the main routine.

What to turn in:

You should turn in a floppy disk containing the program describe above (all three files) at the start of class two weeks from the assignment date. The disk should be labeled (on the outside) with your name and section number. The disk should contain either a cleaned workspace for this assignment or you can turn in just the C++ source code described above. Either format will be accepted.