
178 ◾ Computational Thinking for the Modern Problem Solver
Figure 6.13 adds behaviors to the gasoline pump state diagram.
e transitions and associated events in Figure6.13 are the same as in
Figure6.12. e only dierence is that actions have been added.
An entry action is appropriate whenever the action needs to occur upon
a transition into the state. Entering the Verifying state causes the custom-
er’s credit card to be checked for validity and entering the Receipt state
cause the customer’s receipt to be printed. Exit actions occur whenever a
transition is made from a state. Sometimes an equivalent state diagram
can be drawn by substit ...