Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. function godzillaKong (input){
  2. let budget = Number(input.shift());
  3. let statists = Number(input.shift());
  4. let clothingPricePerStatist = Number(input.shift());
  5. let totalClothing = statists*clothingPricePerStatist;
  6. let decor = budget * 0.1;
  7.  
  8.  
  9. if (statists > 150){
  10. totalClothing = totalClothing - (totalClothing*0.1);
  11. } else{
  12. totalClothing = totalClothing;
  13. }
  14.  
  15. let finalPrice = totalClothing + decor;
  16.  
  17. if (finalPrice > budget){
  18. console.log('Not enough money!');
  19. console.log('Wingard needs '+ ((finalPrice-budget).toFixed(2))+ ' leva more.');
  20. } else if (finalPrice < budget){
  21. console.log('Action!');
  22. console.log('Wingard starts filming with '+ ((budget-finalPrice).toFixed(2))+ ' leva left.');
  23.  
  24. }
  25. }
  26. godzillaKong(['20000', '120', '55.5']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement