TZinovieva

Oscars Week In Cinema JS

Nov 17th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function oscarsWeekInCinema(input) {
  2.     let movie = input[0];
  3.     let hallType = input[1];
  4.     let ticketsSold = Number(input[2]);
  5.  
  6.     let ticketPrice = 0;
  7.     let income = ticketsSold * ticketPrice;
  8.  
  9.     switch (movie) {
  10.         case "A Star Is Born":
  11.             if (hallType === "normal") {
  12.                 income = ticketsSold * 7.50;
  13.             } else if (hallType === "luxury") {
  14.                 income = ticketsSold * 10.50;
  15.             } else {
  16.                 income = ticketsSold * 13.50;
  17.             }
  18.             break;
  19.         case "Bohemian Rhapsody":
  20.             if (hallType === "normal") {
  21.                 income = ticketsSold * 7.35;
  22.             } else if (hallType === "luxury") {
  23.                 income = ticketsSold * 9.45;
  24.             } else {
  25.                 income = ticketsSold * 12.75;
  26.             }
  27.             break;
  28.         case "Green Book":
  29.             if (hallType === "normal") {
  30.                 income = ticketsSold * 8.15;
  31.             } else if (hallType === "luxury") {
  32.                 income = ticketsSold * 10.25;
  33.             } else {
  34.                 income = ticketsSold * 13.25;
  35.             }
  36.             break;
  37.         case "The Favourite":
  38.             if (hallType === "normal") {
  39.                 income = ticketsSold * 8.75;
  40.             } else if (hallType === "luxury") {
  41.                 income = ticketsSold * 11.55;
  42.             } else {
  43.                 income = ticketsSold * 13.95;
  44.             }
  45.         default:
  46.             break;
  47.     }
  48.     console.log(`${movie} -> ${income.toFixed(2)} lv.`);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment