# Unit 5 – Basic Demo: Thermostat

A thermostat is the panel on the wall where you set the temperature you 
want in a room — "keep it at 22°C." It only accepts reasonable values, 
and the target can only be changed through its own controls, never 
tampered with from the outside.

## Setting up

1. Compile Thermostat.
2. Create `Thermostat("Living Room", 22.0)`.

## Experimenting

3. Call `status()` — the thermostat reports its current target and
   operating mode.
4. Call `setTarget(18.0)`, then `status()` again — the mode switches from
   "heating" to "standby".
5. Try `setTarget(50.0)` — `require` rejects it immediately with a clear
   error message.
6. Try creating `Thermostat("Bedroom", 4.0)` — the `init` block rejects
   the value at construction time, before the object is ever created.
7. Right-click the thermostat on the Object Bench and look at the method
   menu — there is no getter for `targetTemperature`. Private properties
   have no getter or setter in the method menu.

## What to look at in the code

8. `private var targetTemperature` — the property is visible only inside
   the class; no external code can read or write it.
9. The `init` block — runs once when the object is first created, before
   any method is called.
10. `require()` in `init` and in `setTarget()` — rejects invalid values
    immediately with a descriptive message.
11. `status()` — reads `targetTemperature` from inside the class, which
    is always allowed for private members.
