Guest User

Untitled

a guest
May 12th, 2021
68
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let input = ['18', '44'];
  2. let print = this.print || console.log;
  3. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  4.  
  5. let totalMessages = +gets();
  6. let totalMinutes = +gets();
  7.  
  8.  
  9. let messagesOver = (totalMessages - 20) * 0.06;
  10. let minutesOver = (totalMinutes - 60) * 0.10;
  11. let taxes = ((messagesOver + minutesOver) / 100) * 20;
  12. let total = (messagesOver + minutesOver + taxes) + 12;
  13. if (totalMessages <= 20 || totalMinutes <= 60) {
  14.     print('0 additional messages for 0.00');
  15.     print('0 additional minutes for 0.00');
  16.     print('0.00 additional taxes');
  17.     print('12.00 total bill');
  18. } else if (totalMessages > 20 && totalMinutes > 60) {
  19.  
  20.     print(`${totalMessages - 20} additional messages for ${messagesOver.toFixed(2)} levas`);
  21.     print(`${totalMinutes - 60} additional minutes for ${minutesOver.toFixed(2)} levas`);
  22.     print(`${taxes.toFixed(2)} additional taxes`);
  23.     print(`${total.toFixed(2)} total bill`);
  24. }
RAW Paste Data