Advertisement
DraconiusNX

Untitled

Sep 20th, 2022
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movieMaking(data) {
  2.     let movieBudget = Number(data[0]);
  3.     let countStatist = Number(data[1]);
  4.     let priceClothStatist = Number(data[2]);
  5.     let totalPrice = 0;
  6.  
  7.     let priceDeco = movieBudget / 10;
  8.  
  9.     let moneyStatist = countStatist * priceClothStatist;
  10.  
  11.     if (countStatist > 150) {
  12.         moneyStatist = moneyStatist - (moneyStatist * 10 / 100);
  13.         totalPrice = moneyStatist + priceDeco;
  14.     } else {
  15.         totalPrice = moneyStatist + priceDeco;
  16.     }
  17.  
  18.     if (totalPrice > movieBudget) {
  19.         let missingMoney = Math.abs(movieBudget - totalPrice);
  20.         console.log(`Not enough money!`);
  21.         console.log(`Wingard needs ${missingMoney.toFixed(2)} leva more.`);
  22.     } else {
  23.         let extraMoney = movieBudget - totalPrice;
  24.         console.log(`Action!`);
  25.         console.log(`Wingard starts filming with ${extraMoney.toFixed(2)} leva left.`);
  26.     }
  27. }
  28.  
  29. movieMaking(['20000', '120', '55.5']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement