Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function sweetDessert(input) {
- let budget = Number(input[0]);
- let guests = Number(input[1]);
- let bananaPrice = Number(input[2]);
- let eggPrice = Number(input[3]);
- let berriesKiloPrice = Number(input[4]);
- let neededMoney = Math.ceil(guests / 6) * (bananaPrice * 2 + eggPrice * 4 + berriesKiloPrice / 5);
- if (budget >= neededMoney) {
- console.log(`Ivancho has enough money - it would cost ${neededMoney.toFixed(2)}lv.`);
- }
- else {
- console.log(`Ivancho will have to withdraw money - he will need ${(neededMoney - budget).toFixed(2)}lv more.`);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement