Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function godzillaKong (input){
- let budget = Number(input.shift());
- let statists = Number(input.shift());
- let clothingPricePerStatist = Number(input.shift());
- let totalClothing = statists*clothingPricePerStatist;
- let decor = budget * 0.1;
- if (statists > 150){
- totalClothing = totalClothing - (totalClothing*0.1);
- } else{
- totalClothing = totalClothing;
- }
- let finalPrice = totalClothing + decor;
- if (finalPrice > budget){
- console.log('Not enough money!');
- console.log('Wingard needs '+ ((finalPrice-budget).toFixed(2))+ ' leva more.');
- } else if (finalPrice < budget){
- console.log('Action!');
- console.log('Wingard starts filming with '+ ((budget-finalPrice).toFixed(2))+ ' leva left.');
- }
- }
- godzillaKong(['20000', '120', '55.5']);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement