Draw a UML statechart diagram that indicates how a watch with a stopwatch feature works. The watch has two buttons on the side of the case: a mode button and a set button.
The watch starts out in time-keeping mode, showing the time of day. (The system method showTime() is called to show the time of day.)
If the mode button is pressed once, the watch switches to stopwatch mode (by calling the method showStopwatch() followed by the method clear()). In this mode, if the set button is pressed, the stopwatch starts timing (by calling start()). When set is pressed again, the stopwatch stops timing (by calling stop()). A third press of the set key resets the stopwatch to all zeros (by calling clear()).
If the mode button is pressed while the watch is in stopwatch mode (whether it is currently timing or stopped or cleared), the watch enters time-setting mode, indicated by showing the time with the hours flashing (by calling showTime() followed by flashHours()). The set button may then be pushed repeatedly, with each push causing the hours to be incremented (by calling incrHours()). If the mode button is pushed again, the watch indicates that it is ready to set the minutes by flashing the minutes indicators (by calling flashMins()); subsequent presses of the set button then advance the minutes (with incrMins()). A third press of the mode button starts the seconds flashing (flashSecs()); in this mode, a single press of the set button resets the seconds to 0 (by calling resetSecs()) and resumes the normal display of the time. If the mode button is pressed instead of the set button while the seconds indicators are flashing, then the watch resumes the normal display of the time (showTime()) without resetting the seconds.
Figure 1 illustrates how Poseidon draws a statechart diagram.
It does not appear to be possible to draw a single-compartment state oval in Poseidon.

Figure 1. An example of how Poseidon draws a statechart diagram.
Submit the diagram in hard-copy form by the beginning of the class session on Friday, December 7. Late submissions will be assessed a penalty of 10% per day (where the weekend counts as one day).
Copyright © 2003, 2007 Jonathan Mohr