A Travel Expense Accounting System

Suppose your company had some employees traveling around the world to do their business. While traveling they produce all kinds of expenditures for which they would like to get reimbursed from the company. But--as you might know-- the gods have put the travel expense report between the production of expenses and their reimbursement.

Basically a travel expense report is just a list of items with a sum at the bottom, which represents the total return requested. On the surface (façade) an expense is some text and a date combined with an amount of money. Behind this surface there are several kinds of expenses, all with their own logic. In the case of a mileage allowance, the costs are calculated by the number of kilometers multiplied with a rate per kilometer or mile. If you bought a flight ticket, the user requests the actual ticket costs. In the case of a PerDiemAllowance the user enters the hours he has been on the road on a certain day. That’s a classical polymorphic scenario.

A polymorphic scenario