Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. function solution(input){
  2. let budget = Number(input.shift());
  3. let people = Number(input.shift());
  4. let pricePerPeople = Number(input.shift());
  5.  
  6. let decor = budget*0.1;
  7. let totalClothes = people * pricePerPeople;
  8. let moneyOnStock = budget - decor - totalClothes
  9.  
  10. let moneyProb=Math.abs(moneyOnStock-budget);
  11. let moneyLeft= Math.abs(budget-moneyOnStock);
  12.  
  13. if (people >= 150){
  14. totalClothes=totalClothes*0.9;
  15. } else { totalClothes=totalClothes
  16.  
  17. }
  18. if (budget>=moneyOnStock){
  19. console.log(`Action!`);
  20. console.log(`Wingard starts filming with ${moneyLeft.toFixed(2)} leva left.`);
  21. }else{
  22. console.log(`Not enough money!`);
  23. console.log(`Wingard needs ${moneyProb.toFixed(2)} leva more.`);
  24. }
  25.  
  26.  
  27. }
  28.  
  29. solution([
  30. `15437.62`,
  31. `186`,
  32. `57.99`,
  33. ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement