Cancel 10 hours out: what do you get back
transcript
A flexible ticket. 90,000 cents. The customer cancels 10 hours before departure. How much do they get back?
Fare rules are tiers. Minimum hours before departure, and a percent. Flexible: 24 hours or more, full refund. Two hours or more: half. Inside that, nothing.
Start with the longest notice. Ten is under 24. Not this tier. Next: ten is at least two. This tier applies.
Money is whole cents. Never floats. The percent is integer arithmetic. So there are no fractions of a cent in any language.
The rules are data inside one policy. Not an if for each fare name in cancel. A new fare class is a new entry, not new code.
A saver ticket of 50,000, cancelled 100 hours out. Saver gets half from 72 hours: 25,000 back. The flexible one, 10 hours out, gets 45,000.
Longest notice first. First tier that fits.
The full design is in the lecture. Holds, policies, refunds and the close.