Advertisement
Liliana797979

godzilla

Jan 24th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function godzila(input) {
  2.     let budget = Number(input[0]);
  3.     let extraCount = Number(input[1]);
  4.     let priceDressForOne = Number(input[2]);
  5.    
  6.     let priceForAllExtra = extraCount * priceDressForOne;
  7.     let decorPrice = budget - (budget * 0.9);
  8.  
  9.     if (extraCount > 150) {
  10.        priceForAllExtra = priceForAllExtra * 0.9;
  11.     }
  12.  
  13.     let totalMoney = decorPrice + priceForAllExtra;
  14.  
  15.     if (totalMoney > budget) {
  16.         console.log(`Not enough money!`);
  17.         console.log(`Wingard needs ${(totalMoney - budget).toFixed(2)} leva more.`);
  18.     } else {
  19.         console.log(`Action!`);
  20.         console.log(`Wingard starts filming with ${(budget - totalMoney).toFixed(2)} leva left.`);
  21.     }  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement