Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function funds(input){
- let budget = Number(input[0]);
- let walkerOn = parseInt(input[1]);
- let priceClothing = Number(input[2]);
- let discount = 0.00, total = 0.00;
- let decor = ((budget * 10) / 100);
- let clothingSum = walkerOn * priceClothing;
- if(walkerOn > 150){
- discount = clothingSum * 0.10;
- }
- total = ((decor + clothingSum) - discount);
- let payment = Math.abs((budget - total));
- if (budget >= total){
- console.log('Action!');
- console.log(`Wingard starts filming with ${(payment).toFixed(2)} leva left.`);
- }
- else{
- console.log('Not enough money!');
- console.log(`Wingard needs ${(payment).toFixed(2)} leva more.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment