Your task is to build a stopwatch to keep precise track of lap times.
The stopwatch uses four commands (start, stop, lap, and reset) to keep track of:
What commands can be used depends on which state the stopwatch is in:
| Command | Begin state | End state | Effect |
|---|---|---|---|
| Start | Ready | Running | Start tracking time |
| Start | Stopped | Running | Resume tracking time |
| Stop | Running | Stopped | Stop tracking time |
| Lap | Running | Running | Add current lap to previous laps, then reset current lap |
| Reset | Stopped | Ready | Reset current lap and clear previous laps |
Your task is to build a stopwatch to keep precise track of lap times.
The stopwatch uses four commands (start, stop, lap, and reset) to keep track of:
What commands can be used depends on which state the stopwatch is in:
| Command | Begin state | End state | Effect |
|---|---|---|---|
| Start | Ready | Running | Start tracking time |
| Start | Stopped | Running | Resume tracking time |
| Stop | Running | Stopped | Stop tracking time |
| Lap | Running | Running | Add current lap to previous laps, then reset current lap |
| Reset | Stopped | Ready | Reset current lap and clear previous laps |