Advertisement
Guest User

edited

a guest
Feb 19th, 2020
838
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function movie(input) {
  2.     let budget = Number(input.shift());
  3.     let countWalkons = Number(input.shift());
  4.     let priceClothes = Number(input.shift());
  5.  
  6.     let priceDecor = budget * 0.10;
  7.  
  8.     if (countWalkons > 150) {
  9.         priceClothes -= priceClothes * 0.10;
  10.     }
  11.  
  12.     let totalPriceClothes = countWalkons * priceClothes;
  13.     let neededMoney = priceDecor + totalPriceClothes;
  14.     let result = Math.abs(budget - neededMoney);
  15.  
  16.     if (budget < neededMoney) {
  17.         console.log("Not enough money!");
  18.         console.log(`Wingard needs ${(result.toFixed(2))} leva more.`);
  19.     } else {
  20.         console.log("Action!");
  21.         console.log(`Wingard starts filming with ${result.toFixed(2)} leva left.`)
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement