Readplace

:red_circle: Isolate the code for the first range · FagnerMartinsBrack/jack-the-moneylender@bbc0ed9

GitHub 1 min read
View original
  • current

This article is too short to summarise.

Original file line numberDiff line numberDiff line change

@@ -11,7 +11,7 @@

1111

const END_OF_FIRST_RANGE = Money('$2000.00');

1212

const CENTS_FOR_FIRST_RANGE = Money('$0.00');

1313

const CENTS_FOR_SECOND_RANGE = Money('$0.09');

14-

if (loanAmount.greaterThan(END_OF_FIRST_RANGE)) {

14+

if (loanAmount.greaterThan(END_OF_FIRST_RANGE) && loanAmount.lessThan(Money('$5001.00'))) {

1515

const dollarsAboveThreshold = loanAmount.minus(END_OF_FIRST_RANGE);

1616

const interestAmount = CENTS_FOR_SECOND_RANGE.multipliedBy(dollarsAboveThreshold);

1717

return interestAmount;