@@ -7,9 +7,9 @@
|
7 | 7 | assert.strictEqual(actual, expected); |
8 | 8 | } |
9 | 9 | |
10 | | -const calculateInterestForGreaterThan2000 = (loanAmount, endOfFirstRange, centsForSecondRange) => { |
| 10 | +const calculateInterestForGreaterThan2000 = (loanAmount, endOfFirstRange, centsForSecondRange, centsForFirstRange) => { |
11 | 11 | const dollarsAboveThresholdForGreaterThan2000 = loanAmount.minus(endOfFirstRange); |
12 | | -const interestForGreaterThan2000 = centsForSecondRange.multipliedBy(dollarsAboveThresholdForGreaterThan2000); |
| 12 | +const interestForGreaterThan2000 = centsForSecondRange.minus(centsForFirstRange).multipliedBy(dollarsAboveThresholdForGreaterThan2000); |
13 | 13 | return interestForGreaterThan2000; |
14 | 14 | }; |
15 | 15 | |
|
39 | 39 | let interestAmount = Money('$0.00'); |
40 | 40 | |
41 | 41 | interestAmount = interestAmount.plus( |
42 | | -calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE) |
| 42 | +calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE, CENTS_FOR_FIRST_RANGE) |
43 | 43 | ); |
44 | 44 | |
45 | 45 | return interestAmount; |
@@ -49,7 +49,7 @@
|
49 | 49 | let interestAmount = Money('$0.00'); |
50 | 50 | |
51 | 51 | interestAmount = interestAmount.plus( |
52 | | -calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE) |
| 52 | +calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE, CENTS_FOR_FIRST_RANGE) |
53 | 53 | ); |
54 | 54 | interestAmount = interestAmount.plus( |
55 | 55 | calculateInterestForGreaterThan5000(loanAmount, END_OF_SECOND_RANGE, CENTS_FOR_THIRD_RANGE, CENTS_FOR_SECOND_RANGE) |
@@ -62,7 +62,7 @@
|
62 | 62 | let interestAmount = Money('$0.00'); |
63 | 63 | |
64 | 64 | interestAmount = interestAmount.plus( |
65 | | -calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE) |
| 65 | +calculateInterestForGreaterThan2000(loanAmount, END_OF_FIRST_RANGE, CENTS_FOR_SECOND_RANGE, CENTS_FOR_FIRST_RANGE) |
66 | 66 | ); |
67 | 67 | interestAmount = interestAmount.plus( |
68 | 68 | calculateInterestForGreaterThan5000(loanAmount, END_OF_SECOND_RANGE, CENTS_FOR_THIRD_RANGE, CENTS_FOR_SECOND_RANGE) |
|