Advertisement
vikkktor

Godzilla_vs_Kong

May 19th, 2021 (edited)
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GodzillaVSkong(input) {
  2.     //  Декорът за филма е на стойност 10% от бюджета.
  3.     //  При повече от 150 статиста,  има отстъпка за облеклото на стойност 10%.
  4.  
  5.     /*
  6.     1.  Бюджет за филма – реално число в интервала [1.00 … 1000000.00]
  7.     2.  Брой на статистите – цяло число в интервала [1 … 500]
  8.     3.  Цена за облекло на един статист – реално число в интервала [1.00 … 1000.00]
  9.     */
  10.  
  11.     let budget = Number(input[0]);
  12.     let actorsCount = Number(input[1]);
  13.     let clothesPerActor = Number(input[2]);
  14.  
  15.     let decorPrice = budget * 0.1; // decor = 10% ot budget
  16.     let clothesPrice = clothesPerActor * actorsCount;
  17.     if (actorsCount >= 150) {
  18.         clothesPrice = clothesPrice * 0.9;
  19.     }
  20.     let TotalMoneyNeeded = clothesPrice + decorPrice;
  21.  
  22.     if (TotalMoneyNeeded >= budget) {
  23.         console.log('Not enough money!');
  24.         console.log(`Wingard needs ${(TotalMoneyNeeded-budget).toFixed(2)} leva more.`);
  25.     } else {
  26.         console.log('Action!');
  27.         console.log(`Wingard starts filming with ${(budget-TotalMoneyNeeded).toFixed(2)} leva left.`);
  28.     }
  29. }
  30.  
  31. GodzillaVSkong(["9587.88",
  32. "222",
  33. "55.68"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement