A Design Exercise

The main part of today's lesson is an in-class group Object Oriented Design exercise. We will describe what we need a program to do, and your group will come up with a design to handle it. Your design will take the form of one or more class hierarchies, following the diagram style shown above.

One of the early inspirations for object oriented programming was the needs of programs for doing simulations. In fact, object oriented programming really began with a language called "Simula", which was designed for writing simulations. So, we're going to consider a problem that could be a part of a sophisticated program for doing financial simulations (in the world of person finance ... I don't know anything about business-scale finance, being just a lowly professor). I want a program that will read in a file describing recurring events — like "every 14 days starting on 1/6/2015 I receive a paycheck" — and then simulate the day-by-day passing of time, printing out the events that occur in a day.

in0.txt first 64 lines of output
every 14 days start 1/6/2015 income Paycheck
every 1 months start 1/15/2015 expense Mortgage Due
every 1 months start 1/6/2015 expense Cable Due
every 3 months start 3/21/2015 expense Water/Sewer Due
every 3 months start 3/26/2015 income Stock Dividend
every 1 months start 1/23/2015 expense Credit Card Due
every 1 months start 1/11/2015 expense Car Payment Due
every 1 months start 1/2/2015 expense Car Insurance Due
every 1 months start 1/17/2015 expense Cell Phone Due
every 1 days start 1/7/2015 prob 0.143 expense Groceries
every 1 days start 1/1/2015 prob 0.15 expense Dinner Out
every 7 days start 1/3/2015 prob 0.5 expense Breakfast Out
every 4 days start 1/1/2015 prob 0.5 expense Gas
every 1 days start 1/1/2015 prob 0.01 expense Car Repair
every 12 months start 4/15/2015 expense Taxes Due
every 1 months for 12 start 1/16/2015 expense Lazy Boy Layaway Payment Due
1/1/2015: Dinner Out, Gas
1/2/2015: Car Insurance Due
1/3/2015: Breakfast Out
1/5/2015: Gas
1/6/2015: Paycheck, Cable Due
1/7/2015: Groceries, Dinner Out
1/9/2015: Gas
1/10/2015: Breakfast Out
1/11/2015: Car Payment Due
1/13/2015: Groceries
1/15/2015: Mortgage Due
1/16/2015: Lazy Boy Layaway Payment Due
1/17/2015: Cell Phone Due, Breakfast Out
1/18/2015: Dinner Out
1/20/2015: Paycheck
1/21/2015: Gas
1/23/2015: Credit Card Due
1/24/2015: Groceries
1/25/2015: Gas
1/29/2015: Gas
2/2/2015: Car Insurance Due, Dinner Out
2/3/2015: Paycheck
2/5/2015: Dinner Out
2/6/2015: Cable Due, Dinner Out, Gas
2/7/2015: Breakfast Out
2/8/2015: Groceries
2/10/2015: Dinner Out
2/11/2015: Car Payment Due, Groceries
2/12/2015: Groceries, Dinner Out
2/14/2015: Breakfast Out
2/15/2015: Mortgage Due

Some of the lines in the input file probably deserve some explanation.

The system you're designing needs to be able to read all the events described int he sample input file, and any other file that follows the same basic format. The design itself should consist of one or more class hierarchies given in the same form as the diagram above.