Gringotts isn't just a vault, but a reputable financial institution and wizards need loans too. Since you don't want to be screwed over by the Gringotts goblins, you decided it would be a good idea to write a program to calculate interest. Interest is compounded only yearly.
Your task is to calculate total owed amount after interest given the principal, interest rate, and time (whole years), operating in whole denominations of wizard money, rounding down to the nearest whole Knut. There are 29 Bronze Knuts in a Silver Sickle and 17 Sickles in a Gold Galleon.
Loan taken out: 23 Knuts 16 Sickles 103 Galleons @ 7.250% For 3 years Total owed after interest: 24 Knuts 4 Sickles 128 Galleons
Notes and Rules
- Input and output may be in any convenient format. You must take in Knuts, Sickles, Galleons, interest rate, and time. All but interest rate will be whole numbers. The interest rate is in increments of 0.125%.
- Input money is not guaranteed to be canonical (i.e. you can have 29 or more Knuts and 17 or more Sickles.)
- Output must be the canonical representation. (i.e. less than 29 Knuts and less than 17 Sickles)
- Totals owed, up to 1,000 Galleons, should be accurate to within 1 Knut per year of interest when compared with arbitrary precision calculations.
- You may round down after each year of interest or only at the end. Reference calculations can take this into account for accuracy checks.