Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function easterParty(input) {
- let guest = Number(input.shift());
- let envelope = Number(input.shift());
- let budget = Number(input.shift());
- let sum = guest * envelope;
- if (guest >= 10 && guest <= 15) {
- sum *= 0.85;
- } else if (guest > 15 && guest <= 20) {
- sum *= 0.8;
- } else if (guest > 20) {
- sum *= 0.75;
- }
- sum += budget / 10;
- if (budget >= sum) {
- console.log(`It is party time! ${(budget - sum).toFixed(2)} leva left.`);
- } else {
- console.log(`No party! ${(sum - budget).toFixed(2)} leva needed.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement