- 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.
推薦閱讀
- 網(wǎng)絡(luò)教育學(xué)習(xí)指導(dǎo)
- 智慧城市:大數(shù)據(jù)、互聯(lián)網(wǎng)時(shí)代的城市治理(第4版)
- 6G潛在關(guān)鍵技術(shù)(下冊)
- 物聯(lián)網(wǎng)短距離無線通信技術(shù)應(yīng)用與開發(fā)
- MERN Quick Start Guide
- 射頻通信系統(tǒng)
- Mastering TypeScript 3
- 數(shù)字調(diào)制解調(diào)技術(shù)的MATLAB與FPGA實(shí)現(xiàn):Altera/Verilog版(第2版)
- 邁向自智網(wǎng)絡(luò)時(shí)代:IP自動(dòng)駕駛網(wǎng)絡(luò)
- Learning Storm
- 從實(shí)踐中學(xué)習(xí)手機(jī)抓包與數(shù)據(jù)分析
- LwIP應(yīng)用開發(fā)實(shí)戰(zhàn)指南:基于STM32
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)
- 移動(dòng)互聯(lián)網(wǎng)環(huán)境下的核心網(wǎng)剖析及演進(jìn)
- Corona SDK Application Design