Readplace

:red_circle: Copy the logic for loan amounts greater than $5000.00 · FagnerMartinsBrack/jack-the-moneylender@b06c220

GitHub 1 min read
View original
  • current

This article is too short to summarise.

Original file line numberDiff line numberDiff line change

@@ -38,6 +38,10 @@

3838

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

3939

let interestAmount = Money('$0.00');

4040
41+

const dollarsAboveThresholdForThirdRange = loanAmount.minus(END_OF_SECOND_RANGE);

42+

const interestAmountForThirdRange = CENTS_FOR_THIRD_RANGE.minus(CENTS_FOR_SECOND_RANGE).multipliedBy(dollarsAboveThresholdForThirdRange);

43+

interestAmount = interestAmount.plus(interestAmountForThirdRange);

44+
4145

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

4246

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

4347

interestAmount = interestAmount.plus(interestAmountForFourthRange);