conditionals and options
Triecie77 (0)

Write a program for your smart thermostat. Do the following using a temperature, isRaining, and isOn property,

If the temperature is less than 68 degrees or it is raining, the Air Conditioning should be turned off. Otherwise the Air Conditioning should be turned on.

Try different combinations of temperatures and weather conditions (raining vs not raining) to make sure your thermostat works correctly.

Use a print statement to check the air conditioning's status.
let temperature = 68

If temperature < 68 {
print("the Air Conditioning should be turned off")

}else if temperature >= 68
print("the air conditioning should be turned on")

You are viewing a single comment. View All
Answered by vedprad1 (815) [earned 5 cycles]
View Answer