- Scala Programming Projects
- Mikael Valot Nicolas Jorand
- 96字
- 2021-07-23 16:25:20
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.
推薦閱讀
- 連接未來:從古登堡到谷歌的網絡革命
- 物聯網(IoT)基礎:網絡技術+協議+用例
- Building Django 2.0 Web Applications
- JBoss EAP6 High Availability
- 射頻通信系統
- CCNP TSHOOT(642-832)認證考試指南
- React Cookbook
- Microsoft Power Platform Enterprise Architecture
- 現代通信系統(第5版)
- Getting Started with tmux
- 物聯網基礎及應用
- React Design Patterns and Best Practices(Second Edition)
- 通信系統實戰筆記:無處不在的信號處理
- OSPF協議原理與功能拓展
- Migrating to Drupal7