Advertisement
RRusev77

Hours + 15

Mar 22nd, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(movieBudget, statistCount, singleOutfitPrice){
  2.     movieBudget = Number(movieBudget);
  3.     statistCount = Number(statistCount);
  4.     singleOutfitPrice = Number(singleOutfitPrice);
  5.  
  6.     let decoratingsPrice, outfitPrice, totalSum;
  7.  
  8.     decoratingsPrice = movieBudget * 0.1;
  9.     outfitPrice = statistCount * singleOutfitPrice;
  10.     if(statistCount > 150) {
  11.         outfitPrice = outfitPrice * 0.9;
  12.     }
  13.  
  14.     totalSum = decoratingsPrice + outfitPrice;
  15.     if (movieBudget >= totalSum) {
  16.         console.log(`Action!`);
  17.         console.log(`Wingard starts filming with ${(movieBudget - totalSum).toFixed(2)} leva left.`);
  18.     } else {
  19.         console.log(`Not enough money!`);
  20.         console.log(`Wingard needs ${(totalSum - movieBudget).toFixed(2)} leva more.`);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement