rage / java-programming

https://java-programming.mooc.fi
523 stars 213 forks source link

Local and server tests for Part 04_09.Debt calculate incorrectly #376

Open speters33w opened 2 years ago

speters33w commented 2 years ago

While it would be nice for the banks if interest were calculated this way, this is not how simple interest is calculated. The Calculation in the example shown on the website is correct (one minor typo Debt mortgage = new Debt(120000.0, 1.01); should be Debt mortgage = new Debt(120000.0, 1.0); for the calculations shown to work correctly).

In DebtTest.java, in waitOneYearChangesTheBalance() the line double expected = 1500.0 * 2.0; should read: double expected = 1500.0 + (1500 * .02)

and in waitOneYearChangesTheBalance2() the line double expected = 1500.0 * 2.0 * 2.0; should read: double expected = 1500 + (1500.0 * .02) + ((1500 + (1500.0 * .02)) * .02);

DebtTest.java.txt