September 2018
Intermediate to advanced
398 pages
9h 43m
English
We have implemented some building blocks for parsing the whole arguments array. It is now time to refactor SimulatePlanApp.strMain to call them. First, we need to check that the arguments array has the right size, as shown in the following code:
def strMain(args: Array[String]): Validated[String, String] = { if (args.length != 6) """Usage: |simulatePlan from,until nbOfYearsSaving nbOfYearsRetired netIncome currentExpenses initialCapital | |Example: |simulatePlan 1952.09,2017.09 25 40 3000 2000 10000 |""".stripMargin.invalid else { val allReturns = Returns.fromEquityAndInflationData( equities = EquityData.fromResource("sp500.tsv"), inflations = InflationData.fromResource("cpi.tsv")) val vFromUntil = parseFromUntil ...
Read now
Unlock full access