Professional Documents
Culture Documents
Selection Exercises: Exercise 1 Room Thermostat Problems
Selection Exercises: Exercise 1 Room Thermostat Problems
Selection Exercises: Exercise 1 Room Thermostat Problems
Sam runs a restaurant He notices that the room temperature in his restaurant is sometimes too
cold and sometimes too hot. He would like to use his personal computer to alert him when to
switch on the heating or air-conditioning. Sam thinks 19 oC is about the right minimum room
temperature for his restaurant.
You have been given the task of developing a program that displays a message alerting Sam
when to switch on the heating or air-conditioning.
You are asked to develop the program design in stages in activities 1.1 and 1.2 that will alert
Sam when to switch on the heating.
In one of the forum exercises for Selection part 2, you will be asked to further extend the
functionality of your design to alert Sam when to switch on the air-conditioning.
You should post your solutions as a reply to a thread created for the purpose.
You should post your solutions as a reply to a thread created for the purpose.
Challenges:
1. A problem exists with the final program design after you have completed Activity 1.2, if
we follow the given specification exactly. Can you find the problem and discuss this in the
forum?
2. Think about how you might redesign your solution in structured English to check for an
invalid value entered by a user (for example, a number followed by a character such as
1#) using a simple if statement. Hint: If the room temperature is not an integer, then
display a message about the user's input being an invalid integer. You should post your
solutions as a reply to a thread created for the purpose.