TZinovieva

Godzilla vs. Kong JS

Nov 17th, 2022
59
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 walkons = Number(input[1]);
  4.     let clothing = Number(input[2]);
  5.  
  6.     let decor = budget * 10 / 100;
  7.     let totalClothingPrice = 0;
  8.  
  9.     if (walkons <= 150) {
  10.         totalClothingPrice = clothing * walkons;
  11.     } else {
  12.         totalClothingPrice = (clothing * walkons) - ((clothing * walkons)* 10 / 100);
  13.     }
  14.     let totalPrice = decor + totalClothingPrice;
  15.     if (totalPrice > budget) {
  16.         console.log(`Not enough money!`);
  17.         console.log(`Wingard needs ${(totalPrice - budget).toFixed(2)} leva more.`);
  18.     } else {
  19.         console.log(`Action!`);
  20.         console.log(`Wingard starts filming with ${(budget - totalPrice).toFixed(2)} leva left.`);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment