Advertisement
Guest User

Untitled

a guest
Sep 29th, 2018
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. function vacation(a, b ,c){
  2. let people = parseFloat(a);
  3. let kind = b;
  4. let day = c;
  5.  
  6. let price = 0;
  7.  
  8. if(day === "Friday" && kind === "Students"){
  9. price = people * 8.45;
  10. }
  11. else if (day === "Friday" && kind === "Business"){
  12. price = people * 10.90;
  13. }
  14. else if (day === "Friday" && kind === "Regular"){
  15. price = people * 15;
  16. }
  17.  
  18.  
  19. else if(day === "Saturday" && kind === "Students"){
  20. price = people * 9.80;
  21. }
  22. else if (day === "Saturday" && kind === "Business"){
  23. price = people * 15.60;
  24. }
  25. else if (day === "Saturday" && kind === "Regular"){
  26. price = people * 20;
  27. }
  28.  
  29.  
  30. else if(day === "Sunday" && kind === "Students"){
  31. price = people * 10.46;
  32. }
  33. else if (day === "Sunday" && kind === "Business"){
  34. price = people * 16;
  35. }
  36. else if (day === "Sunday" && kind === "Regular"){
  37. price = people * 22.50;
  38. }
  39.  
  40.  
  41. if (people >= 30 && kind === "Students"){
  42. price = price - 0.15 * price;
  43. }
  44. else if (people >= 100 && kind === "Business"){
  45. price = price - (price / people * 10);
  46. }
  47. else if (people >= 10 && people <= 20 && kind === "Regular"){
  48. price = price - 0.10 * price;
  49. }
  50.  
  51.  
  52. console.log('Total price: ' + price.toFixed(2));
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement