Readplace

:red_circle: Use the previous code as a reference for $10001.00 loan … · FagnerMartinsBrack/jack-the-moneylender@153e370

GitHub 1 min read
View original
  • current

This article is too short to summarise.

Original file line numberDiff line numberDiff line change

@@ -21,7 +21,7 @@

2121

return interestAmount;

2222

}

2323
24-

if (loanAmount.greaterThan(END_OF_SECOND_RANGE)) {

24+

if (loanAmount.greaterThan(END_OF_SECOND_RANGE) && loanAmount.lessThan(Money('$10001.00'))) {

2525

let interestAmount = Money('$0.00');

2626
2727

const dollarsAboveThresholdForSecondRange = loanAmount.minus(END_OF_FIRST_RANGE);

@@ -35,6 +35,16 @@

3535

return interestAmount;

3636

}

3737
38+

if (loanAmount.equalsTo(Money('$10001.00'))) {

39+

let interestAmount = Money('$0.00');

40+
41+

const dollarsAboveThresholdForFourthRange = Money('$10001.00').minus(Money('$10000.00'));

42+

const interestAmountForFourthRange = Money('$0.21').minus(Money('$0.14')).multipliedBy(dollarsAboveThresholdForFourthRange);

43+

interestAmount = interestAmount.plus(interestAmountForFourthRange);

44+
45+

return interestAmount;

46+

}

47+
3848

return CENTS_FOR_FIRST_RANGE;

3949

};

4050