官术网_书友最值得收藏!

Implementing simulatePlan

The implementation for simulatePlan is straightforward; we call futureCapital twice with different arguments:

def simulatePlan(interestRate: Double,
nbOfMonthsSaving: Int, nbOfMonthsInRetirement: Int,
netIncome: Int, currentExpenses: Int, initialCapital:
Double) : (Double, Double) = {
val capitalAtRetirement = futureCapital(
interestRate = interestRate, nbOfMonths = nbOfMonthsSaving,
netIncome = netIncome, currentExpenses = currentExpenses,
initialCapital = initialCapital)

val capitalAfterDeath = futureCapital(
interestRate = interestRate, nbOfMonths = nbOfMonthsInRetirement,
netIncome = 0, currentExpenses = currentExpenses,
initialCapital = capitalAtRetirement)

(capitalAtRetirement, capitalAfterDeath)
}

Run RetCalcSpec again, and it should pass now. Feel free to experiment calling simulatePlan from the Scala Console with different values.

主站蜘蛛池模板: 鄢陵县| 浦江县| 平定县| 栾城县| 靖边县| 延吉市| 靖州| 朝阳区| 涿州市| 马边| 慈溪市| 咸宁市| 独山县| 新津县| 高清| 隆化县| 从化市| 利川市| 伽师县| 乐亭县| 米泉市| 阿瓦提县| 依安县| 永昌县| 清徐县| 望谟县| 深水埗区| 江口县| 日土县| 永德县| 涞源县| 高唐县| 徐闻县| 扎囊县| 松阳县| 开封市| 渑池县| 高碑店市| 洪泽县| 伽师县| 抚州市|