Guest User

Untitled

a guest
Nov 22nd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. const interestToPayFor = (loanAmount) => {
  2. const greaterThan2000 = { endOfRange: Money('$2000.00'), interestPerDollar: Money('$0.09'), previousInterestPerDollar: Money('$0.00') };
  3. const greaterThan5000 = { endOfRange: Money('$5000.00'), interestPerDollar: Money('$0.14'), previousInterestPerDollar: Money('$0.09') };
  4. const greaterThan10000 = { endOfRange: Money('$10000.00'), interestPerDollar: Money('$0.21'), previousInterestPerDollar: Money('$0.14') };
  5. let interestAmount = Money('$0.00');
  6. if (loanAmount.greaterThan(Money('$2000.00'))) {
  7. interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));
  8. }
  9. if (loanAmount.greaterThan(Money('$5000.00'))) {
  10. interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));
  11. }
  12. if (loanAmount.greaterThan(Money('$10000.00'))) {
  13. interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan10000));
  14. }
  15. return interestAmount;
  16. };
Add Comment
Please, Sign In to add comment