Advertisement
3vo

Tips

3vo
Oct 18th, 2022 (edited)
689
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Tips
  2. //
  3. // You are at a restaurant and the waiter brings you the bill. You will have to calculate how much the tip must be. The tips are different in different countries, but here we will use 10%.
  4. // Input
  5. // On the first line you will receive the price of the meal you ordered.
  6. // Output
  7. //
  8. // You should print the total sum you have to pay (including the tip: 10%)
  9. //
  10. // Constraints
  11. //
  12. // The final sum will be always a whole number. You don't have to print anything after the decimal point.
  13. //
  14. // Input
  15. //
  16. // 10
  17. //
  18. // Output
  19. // sample input
  20. // each line should consist of single string and a comma right after
  21. let input = ['20'];
  22.  
  23. let print = this.print || console.log;
  24. let gets = this.gets || ((arr, index) => () => arr[index++])(input, 0);
  25. // Price of the meal you ordered
  26. let price = Number(gets()); //number
  27. //total sum you have to pay (including the tip: 10%)
  28. let bill = price + (price * 0.1);
  29. //print
  30. console.log(bill);
  31.  
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement