Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 1.37 KB

README.md

File metadata and controls

13 lines (10 loc) · 1.37 KB

Description

  • This is a solution for the question below:

    • Write and test a program to complete the three tasks. The temperature in an apartment needs to be kept between 22°C and 24°C. This is done by the use of an automatically controlled air-conditioning system, which monitors the temperature every five minutes. The temperature of the apartment is recorded, to one decimal place, in degrees Celsius. The cooling is activated when the temperature reaches 24.5°C and the heating is activated when the temperature reaches 21.5°C.

    TASK 1

    • To simulate the monitoring required, write a routine that allows entry of the apartment’s temperature in degrees Celsius. The routine checks whether the temperature is within the acceptable range, too high or too low and outputs a suitable message in each case.

    TASK 2

    • Write another routine that stores, in an array, the temperatures taken over a period of five hours. This routine calculates the difference between the highest temperature and the lowest temperature. Then it outputs the highest temperature, the lowest temperature, and the difference between these temperatures.

    TASK 3

    • Write a routine to find out how often the temperature was out of the acceptable range during the five hours and whether the temperature was too high or too low; output a suitable message showing a summary of the problem.