Advertisement
Liliana797979

film premiere

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