Advertisement
Didart

Godzilla Vs Kong

Mar 7th, 2022
1,119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function godzillaVsKong(input) {
  2.     let budget = Number(input[0]);
  3.     let statistsCount = Number(input[1]);
  4.     let outfitPrice = Number(input[2]);
  5.  
  6.     let decor = budget * 0.1;
  7.     let totalMoneyForOutfit = statistsCount * outfitPrice;
  8.  
  9.     if (statistsCount > 150) {
  10.         totalMoneyForOutfit = totalMoneyForOutfit * 0.9;
  11.     }
  12.  
  13.     let totalSum = decor + totalMoneyForOutfit;
  14.  
  15.     if (budget >= totalSum) {
  16.         console.log("Action!");
  17.         console.log(`Wingard starts filming with ${(budget - totalSum).toFixed(2)} leva left.`);
  18.     } else {
  19.         console.log("Not enough money!");
  20.         console.log(`Wingard needs ${(totalSum - budget).toFixed(2)} leva more.`);
  21.     }
  22. }
  23.  
  24. godzillaVsKong(["20000", "120", "55.5"])
  25.  
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement