Write a class Thermostat (not public, in the same file) and a public class ThermostatApp.
Thermostat has private fields target (starts at 20) and on (starts true), constants MIN = 10 and MAX = 30, and methods:
| method | behaviour |
|---|---|
boolean setTarget(int t) |
accepts only MIN..MAX; returns whether it changed |
void raise() / void lower() |
±1 degree, never leaving the range |
void toggle() |
switches on/off |
int getTarget(), boolean isOn() |
accessors |
String toString() |
Thermostat[ON, target=21] |
main reads commands until the end of input: up, down, set 25, power, show. A rejected set prints Rejected: 35 is outside 10..30; an unknown word prints Unknown command: …. At the end print Final: and the thermostat.