tedo1111

Untitled

Sep 15th, 2023
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. function hello(input) {
  2.  
  3. let n = +input[0];
  4. let word = input[1];
  5.  
  6.  
  7. let taxiDay = 0.7 + (0.79 * n);
  8. let taxiNight = 0.7 + (0.9 * n);
  9.  
  10. let bus = 0.09 * n;
  11.  
  12. let train = 0.06 * n;
  13.  
  14.  
  15.  
  16.  
  17. if (n <= 20 && word === "day") {
  18. console.log(taxiDay.toFixed(2));
  19. }
  20. else if (n <= 20 && word === "night") {
  21. console.log(taxiNight.toFixed(2));
  22. }
  23.  
  24. else if (n > 20 && n < 100) {
  25. console.log(bus.toFixed(2));
  26. }
  27. else if (n >= 100 && n <= 5000) {
  28. console.log(train.toFixed(2));
  29. }
  30.  
  31.  
  32.  
  33.  
  34. }
  35. hello(["180", "night"]);
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment