
118 ◾ Computational Thinking for the Modern Problem Solver
e rectangle on the le abstractly describes the thermostat pictured to
its right. A class diagram rectangle consists of three parts, diagrammed in
three horizontal compartments. e name of the class of objects (in this
case ermostat) is in the top compartment. e middle compartment
lists attributes. e thermostat can be abstracted into three attributes: (1)
the current position of the upper le switch (COOL, OFF, or HEAT); (2)
the current position of the upper-right fan switch (either ON or AUTO);
(3) the current setting of the rotary temperature dial.
e operations in a clas ...