Guest User

Untitled

a guest
Nov 22nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. let interestAmount = Money('$0.00');
  2.  
  3. - if (loanAmount.greaterThan(ranges[0].endOfRange)) {
  4. - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[0]));
  5. - }
  6. -
  7. - if (loanAmount.greaterThan(ranges[1].endOfRange)) {
  8. - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[1]));
  9. - }
  10. -
  11. - if (loanAmount.greaterThan(ranges[2].endOfRange)) {
  12. - interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[2]));
  13. + for (let i = 0; i < ranges.length; i += 1) {
  14. + if (loanAmount.greaterThan(ranges[i].endOfRange)) {
  15. + interestAmount = interestAmount.plus(calculateInterest(loanAmount, ranges[i]));
  16. + }
  17. }
  18.  
  19. return interestAmount;
Add Comment
Please, Sign In to add comment