Advertisement
AlexandrP

05. Godzilla vs. Kong

Nov 20th, 2022
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function GodzillaKong (input) {
  2.     let budget = input [0];
  3.     let statists = Number (input [1]);
  4.     let cloth = Number (input [2]);
  5.     let decoration = (budget * 0.1);
  6.    
  7.  
  8.     let charge = statists * cloth;
  9.  
  10.    
  11.    
  12.     if (statists >=150) {
  13.         charge = charge * 0.9;
  14.    }
  15.  
  16.  let total = charge + decoration;
  17.  
  18.  
  19.     if (total <= budget) {
  20.         let nedostig = budget - total
  21.     console.log (`Action! Wingard starts filming with ${nedostig.toFixed(2)} leva left.`)
  22.     }
  23.    
  24.     if (total > budget) {
  25.         let poveche = total - budget
  26.     console.log (`Not enough money! Wingard needs ${poveche.toFixed(2)} leva more.`)  
  27.     }
  28.  
  29.  
  30.     }
  31.  
  32.     GodzillaKong (["9587.88",
  33.     "222",
  34.     "55.68"])
  35.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement