Advertisement
Liliana797979

film premiere

Jan 28th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function filmPremiere(input) {
  2.     let projection = input[0];
  3.     let packetForFilm = input[1];
  4.     let ticketsCount = Number(input[2]);
  5.     let price = 0;
  6.  
  7.     swith (projection) {
  8.         case "John Wick":
  9.         switch (packetForFilm) {
  10.             case "Drink":
  11.                 price = ticketsCount * 12;
  12.                 break;
  13.             case "Popcorn":
  14.                 price = ticketsCount * 15;
  15.                 break;
  16.             case "Menu":
  17.                 price = ticketsCount * 19;
  18.         }
  19.         break;
  20.  
  21.         case "Stars Wars":
  22.         switch (packetForFilm) {
  23.             case "Drink":
  24.                 price = ticketsCount * 18;
  25.                 break;
  26.             case "Popcorn":
  27.                 price = ticketsCount * 25;
  28.                 break;
  29.             case "Menu":
  30.                 price = ticketsCount * 30;
  31.                 break;
  32.         }
  33.         break;
  34.    
  35.         case "Jumanji":
  36.         switch (packetForFilm) {
  37.             case "Drink":
  38.                 price = ticketsCount * 9;
  39.                 break;
  40.             case "Popcorn":
  41.                 price = ticketsCount * 11;
  42.                 break;
  43.             case "Menu":
  44.                 price = ticketsCount * 14;
  45.                 break;
  46.         }
  47.         break;
  48.  
  49.         if (projection === "Star Wars" && ticketsCount >= 4) {
  50.             price = price * 0.7;
  51.         } else if (projection === "Jumanji" && ticketsCount === 2) {
  52.             price = price * 0.85;
  53.         }
  54.         console.log(`Your bill is ${(price).toFixed(2)} leva.`);
  55.     }
  56.  
  57. filmPremiere(["John Wick", "Drink", "6"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement