September 2018
Intermediate to advanced
398 pages
9h 43m
English
Here is the unit test you need to add to RetCalcSpec:
"RetCalc.simulatePlan" should { "calculate the capital at retirement and the capital after death" in { val (capitalAtRetirement, capitalAfterDeath) = RetCalc.simulatePlan( interestRate = 0.04 / 12, nbOfMonthsSaving = 25 * 12, nbOfMonthsInRetirement = 40 * 12, netIncome = 3000, currentExpenses = 2000, initialCapital = 10000) capitalAtRetirement should === (541267.1990) capitalAfterDeath should === (309867.5316) }}
Select the call to simulatePlan, and hit Alt + Enter to let IntelliJ create the function for you in RetCalc. It should have the following signature:
def simulatePlan(interestRate: Double, nbOfMonthsSavings: Int, nbOfMonthsInRetirement: Int, netIncome: ...
Read now
Unlock full access