September 2018
Intermediate to advanced
398 pages
9h 43m
English
Since simulatePlan calls futureCapital, we need to change its implementation to take into account the new return type, as shown in the following code:
def simulatePlan(returns: Returns, params: RetCalcParams, nbOfMonthsSavings: Int, monthOffset: Int = 0): Either[RetCalcError, (Double, Double)] = { import params._ for { capitalAtRetirement <- futureCapital( returns = OffsetReturns(returns, monthOffset), nbOfMonths = nbOfMonthsSavings, netIncome = netIncome, currentExpenses = currentExpenses, initialCapital = initialCapital) capitalAfterDeath <- futureCapital( returns = OffsetReturns(returns, monthOffset + nbOfMonthsSavings), nbOfMonths = nbOfMonthsInRetirement, netIncome = 0, currentExpenses = currentExpenses,
Read now
Unlock full access