Model a thermostat that controls a heater. The heater has two states: on and off.

In the initial state, if the temperature is less than or equal to 20 degrees Celsius, it turns the heater on, and leaves it on for at least 30 seconds. After that, if the temperature is greater than 20 degrees, it turns the heater off and leaves it off for at least 2 minutes. It turns it on again only if the temperature is less than or equal to 20 degrees.

Model a system that behaves as described above, assuming it reacts exactly only once every 30 seconds.

Use the variable names temp, heatOn, heatOff and time.
