Advertisement
goshex

Phone bill problem

Dec 16th, 2021 (edited)
167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let textAmmount = +gets();
  2. let minutesAmount = +gets();
  3.  
  4. if (textAmmount <= 20) {
  5.   print(`0 additional messages for 0.00 levas`);
  6.   var additionalMessages = 0;
  7. } else if (textAmmount > 20) {
  8.   var additionalMessages = +((textAmmount - 20) * 0.06).toFixed(2);
  9.   print(
  10.     `${textAmmount - 20} additional messages for ${additionalMessages} levas`
  11.   );
  12. }
  13.  
  14. if (minutesAmount <= 60) {
  15.   print(`0 additional minutes for 0.00 levas`);
  16.   var additionalMinutes = 0;
  17. } else if (minutesAmount > 60) {
  18.   var additionalMinutes = +((minutesAmount - 60) * 0.10).toFixed(2);
  19.   print(
  20.     `${minutesAmount - 60} additional minutes for ${additionalMinutes} levas`
  21.   );
  22. }
  23.  
  24. let totalThings = additionalMessages + additionalMinutes;
  25. if (totalThings === 0) {
  26.   print(`0.00 additional taxes`);
  27.   var tax = 0;
  28. } else if (totalThings > 0) {
  29.   var tax = +(totalThings * 0.2).toFixed(2);
  30.   print(`${tax} additional taxes`);
  31. }
  32.  
  33. let totalBill = 12 + +(additionalMessages + additionalMinutes + tax).toFixed(2);
  34.  
  35. print(`${totalBill} total bill`);
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement