Advertisement
Liliana797979

easter party

Dec 20th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function easterParty(arg1, arg2, arg3) {
  2.     let guestsCount = Number(arg1);
  3.     let coverPriceForMan = Number(arg2);
  4.     let budget = Number(arg3);
  5.  
  6.     if (guestsCount >= 10 && guestsCount <= 15) {
  7.         price = coverPriceForMan * 0.85;
  8.     } else if (guestsCount >= 15 && guestsCount <= 20) {
  9.         price = coverPriceForMan * 0.8;
  10.     } else if (guestsCount > 20) {
  11.         price = coverPriceForMan * 0.75;
  12.     }
  13.  
  14.     let cakePrice = 0.1 * budget;
  15.     let totalMoney = guestsCount * coverPriceForMan + cakePrice;
  16.  
  17.     if (budget >= totalMoney) {
  18.         console.log(`It is party time! ${(budget - totalMoney).toFixed(2)} leva left.`);
  19.     } else if (budget < totalMoney){
  20.         console.log(`No party! ${(totalMoney - budget).toFixed(2)} leva needed.`);
  21.     }
  22. }
  23.  
  24. easterParty("24", "35", "550");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement