gskorchev

cinema

Jan 29th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cinema(input) {
  2.     let type = input.shift();
  3.     let row = Number(input.shift());
  4.     let columns = Number(input.shift());
  5.     let ticketPrice = 0;
  6.     if (type == "Premiere") {
  7.         ticketPrice = 12;
  8.         price = row * columns * ticketPrice;
  9.     } else if (type == "Normal") {
  10.         ticketPrice = 7.50;
  11.         price = row * columns * ticketPrice;
  12.     } else if (type == "Discount") {
  13.         ticketPrice = 5.00;
  14.         price = row * columns * ticketPrice;
  15.     }
  16.     console.log(price.toFixed(2) + " leva");
  17. }
  18.  
  19. cinema(["Normal", 21, 13]);
Advertisement
Add Comment
Please, Sign In to add comment