Finished 4.6: Program Development
Example 4.9 from Section 4.7 - unmodified