CSE 1341: CS I (Fall, 1999)
Homework Assignment #4
Due Date: Wednesday, 9/22/99, before midnight.
Programming Assignment
Design and implement a program to simulate the operation
of a climate control system (CCS),
which satisfies the following operating rules:
- Target temperature can be set when the CCS is started.
- Tolerance can also be set when the CCS is started.
- During the operation, the CCS periodically (repeatedly)
measures the current temperature and performs the following:
- if the temperature falls below target temperature - tolerance,
the heater is turned on
- if the temperature increases above target temperature + tolerance,
the AC is turned on
- The CCS can be turned off by the user.
In your simulator (the simulation program),
a temperature measurement can be replaced by a user input,
and the actions of turning heater/AC on can be replaced
by just printing the appropriate message.
As for the choice of continuing operation and shutting off CCS,
you may use a number code (for example, 0 for one choice
and 1 for the other).
Standard Test Values
After testing/debugging with your own input values,
make sure that your program works with the following
temperature readings:
- 98
- 80
- 69
- 72
- 68
- 70
- shut off
Assuming that the target temperature is 70 degrees
(F), and tolerance is 1 degree.
What to Turn in
You need to e-mail both your program, and a trace of its execution
(remember "script") to your TA by the due date.
Prepared by Jeff Tian
(tian@seas.smu.edu).
Last update Sept. 9, 1999.