Advertisement
Guest User

Untitled

a guest
Dec 6th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. const getGets = (arr) => {
  2. let index = 0;
  3.  
  4. return () => {
  5. const toReturn = arr[index];
  6. index += 1;
  7. return toReturn;
  8. };
  9. };
  10.  
  11. // This is the place where you must place your test data
  12. const test = [
  13. '2000' // This is the first line from the test.
  14. // This is the second line from the test.
  15. ];
  16.  
  17. const gets = this.gets || getGets(test);
  18. const print = this.print || console.log;
  19.  
  20. // Solution of the problem. All the above code is for local testing. The test variable is with the first test case 2 + 2 = 4
  21. let balance = +gets();
  22. let interest = (balance / 100) * 5;
  23.  
  24. /* function roundToTwo(balance) {
  25. return +(Math.round(balance + "e+2") + "e-2");
  26. } */
  27.  
  28. balance =(((balance + interest) * 100) / 100);
  29. print(balance);
  30. for (let index = 0; index < 2; index++) {
  31. interest = (balance / 100) * 5;
  32. balance = (Math.round((balance + interest) * 100) / 100);
  33. print(balance);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement