Advertisement
Spocoman

World Snooker Championship

Feb 13th, 2022
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function  WorldSnookerChampionship(input) {
  2.     let stageOfTheChampionship = input[0];
  3.     let typesOfTickets = input[1];
  4.     let ticketCount = Number(input[2]);
  5.     let selfieWithTheTrophy = input[3];
  6.     let ticketPrice = 0;
  7.  
  8.     if (stageOfTheChampionship === "Quarter final") {
  9.         if (typesOfTickets === "Standard") {
  10.             ticketPrice = 55.50;
  11.         } else if (typesOfTickets === "Premium") {
  12.             ticketPrice = 105.20;
  13.         } else if (typesOfTickets === "VIP") {
  14.             ticketPrice = 118.90;
  15.         }
  16.     } else if (stageOfTheChampionship === "Semi final") {
  17.         if (typesOfTickets === "Standard") {
  18.             ticketPrice = 75.88;
  19.         } else if (typesOfTickets === "Premium") {
  20.             ticketPrice = 125.22;
  21.         } else if (typesOfTickets === "VIP") {
  22.             ticketPrice = 300.40;
  23.         }
  24.     } else if (stageOfTheChampionship === "Final") {
  25.         if (typesOfTickets === "Standard") {
  26.             ticketPrice = 110.10;
  27.         } else if (typesOfTickets === "Premium") {
  28.             ticketPrice = 160.66;
  29.         } else if (typesOfTickets === "VIP") {
  30.             ticketPrice = 400;
  31.         }
  32.     }
  33.     let totalPrice = ticketPrice * ticketCount;
  34.  
  35.     if (totalPrice > 4000) {
  36.         totalPrice *= 0.75;
  37.         selfieWithTheTrophy = "N";
  38.     } else if (totalPrice > 2500) {
  39.         totalPrice *= 0.9;
  40.     }
  41.  
  42.     if (selfieWithTheTrophy === "Y") {
  43.         totalPrice += ticketCount * 40;
  44.     }
  45.    
  46.     console.log(`${totalPrice.toFixed(2)}`);
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement