Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function cruiseChip(input) {
- let budget = Number(input[0]);
- let towel = Number(input[1]);
- let discount = Number(input[2]);
- let umbrella = towel / 3 * 2;
- let flipFlops = umbrella * 0.75;
- let beachBag = (towel + flipFlops) / 3;
- let sum = (towel + umbrella + flipFlops + beachBag) * (100 - discount) / 100;
- if (budget >= sum) {
- console.log(`Annie's sum is ${sum.toFixed(2)} lv. She has ${(budget - sum).toFixed(2)} lv. left.`);
- } else {
- console.log(`Annie's sum is ${sum.toFixed(2)} lv. She needs ${(sum - budget).toFixed(2)} lv. more.`);
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement