vborislavova

06. Godzilla vs. Kong - Conditional Statements - Exercise

Feb 22nd, 2020
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function godzillaVsKong(input) {
  2.     let budget = Number(input.shift());
  3.     let statist = Number(input.shift());
  4.     let clothing = Number(input.shift());
  5.  
  6.     let decor = budget * 0.1;
  7.     let sumClothing = statist * clothing;
  8.  
  9.     if (statist > 150) {
  10.         sumClothing = sumClothing - (sumClothing * 0.1);
  11.     }
  12.  
  13.     let filmCost = decor + sumClothing;
  14.  
  15.     if (filmCost <= budget) {
  16.         console.log(`Action!`)
  17.         console.log(`Wingard starts filming with ${(budget - filmCost).toFixed(2)} leva left.`)
  18.     }else {
  19.         console.log(`Not enough money!`)
  20.         console.log(`Wingard needs ${(Math.abs(budget-filmCost)).toFixed(2)} leva more.`)
  21.     }
  22.  
  23.    
  24. }
Add Comment
Please, Sign In to add comment