No. The class could be improved with additional code. But the goal here is to show the automaton, not develop a date class.
We want to convert
strings like "01/06/01" into
We already have an automaton from chapter 2 that recognizes
strings in this format.
It is often very helpful to divide a problem into
two parts: parsing (recognition of valid input),
When the parsing part of the problem is complete,
the full solution is just a few additional steps.
To plan the string-to-date program,
think about what should be done for each state transition.
If the diagram were on paper
(perhaps on the back of an old envelope)
you could scribble brief
notes on what should happen for each transition.
you would probably SAVE each character
of the first number (for the day) in a string,
then CONVERT that string to an
int when the first
/ is reached.
Then you would do the same with the month and the year.
Mentally label the transitions with SAVE or CONVERT.