dninov81

06. Godzilla vs. Kong

May 4th, 2020
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function result(buget, extras, price){
  2.     buget = Number(buget);
  3.     extras = Number(extras);
  4.     price = Number(price);
  5.     let decor = buget*0.1;
  6.     let totalPrice;
  7.        
  8.           if (extras < 150  ){
  9.             totalPrice = extras*price;
  10.             }
  11.           else if (extras >= 150  ){
  12.              totalPrice = (extras*price)*0.9;
  13.             }
  14.  
  15.     let bugetLeft = (buget) - (decor + totalPrice);  
  16.  
  17.          if (buget > decor + totalPrice){
  18.          console.log(`Action!
  19. Wingard starts filming with ${bugetLeft.toFixed(2)} leva left.`);
  20.          }
  21.           else if(buget < decor + totalPrice){
  22.           console.log(`Not enough money!
  23. Wingard needs ${Math.abs(bugetLeft.toFixed(2))} leva more.`);
  24.         }
  25.      
  26.       }
  27.  
  28.   result("20000",
  29.   "120",
  30.   "55.5")
  31.  ;
Advertisement
Add Comment
Please, Sign In to add comment