Advertisement
pacho_the_python

Cinema

Jul 17th, 2022
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function calculateProfit(input){
  2.     let event = input[0];
  3.     let row = Number(input[1])
  4.     let col = Number(input[2])
  5.  
  6.     function getSeats(r, c) {
  7.         let result = r * c
  8.         return result
  9.     }    
  10.     let profit  = 0;
  11.  
  12.     if (event === "Premiere") {
  13.         profit = getSeats(row, col) * 12
  14.     } else if (event === "Normal") {
  15.         profit = getSeats(row, col) * 7.50
  16.     } else if (event === "Discount") {
  17.         profit = getSeats(row, col) * 5
  18.     }
  19.     console.log(`${profit.toFixed(2)} leva`)
  20. }
  21.  
  22. //calculateProfit(["Premiere", "10", "12"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement