Now that we have a way of expressing variable returns, we need to change our futureCapital function to accept a Returns type instead of a monthly interest rate of type Double. Change the tests first:
"RetCalc.futureCapital" should { "calculate the amount of savings I will have in n months" in { // Excel =-FV(0.04/12,25*12,1000,10000,0) val actual = RetCalc.futureCapital(FixedReturns(0.04), nbOfMonths = 25 * 12, netIncome = 3000, currentExpenses = 2000, initialCapital = 10000).right.value val expected = 541267.1990 actual should ===(expected) } "calculate how much savings will be left after having taken a pension for n months" in { val actual = RetCalc.futureCapital(FixedReturns(0.04), nbOfMonths = 40 * 12, netIncome = ...