Smart Thermostat exercise
Tmeadows97

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.

// My code, as is, works but it makes the constant labels seem strange. Specifically, the isOn constant. I'm also getting an error like other people where it doesn't match my teachers answer which is:
( false| true )


Any advice is much appreciated. Thank you! This is Swift btw.

You are viewing a single comment. View All
CodeLongAndPros

To fix the error where output is different, you can just change you output:

Tmeadows97

@CodeLongAndPros

This is the error I get.

CodeLongAndPros

@Tmeadows97 I can't help if the test case is strange. That should be a question for your teacher

Tmeadows97

@CodeLongAndPros
Ok thanks for your help though.

CodeLongAndPros

@Tmeadows97 I like to think that I did pretty good without knowing a single thing about swift :D.

However, can you try printing boolean values?
I think the test cases is false OR true.

Tmeadows97

@CodeLongAndPros
I thought it could be OR too but I have never seen it print like that.
false| true

I thought it would be like " false || true ". "||" this is the OR swift operator.

CodeLongAndPros

@Tmeadows97 Ah. I was reading it as a regex.

Tmeadows97

@CodeLongAndPros

I think you were right about the test case being wrong.
I printed exactly what it said it was missing and it passed me even though I'm positive that " false| true " makes no sense.