Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function braceletStand(input) {
- let index = 0;
- let pocketCash = Number(input[index]);
- index++;
- let earnedCash = Number(input[index]);
- index++;
- let expenses = Number(input[index]);
- index++;
- let giftPrice = Number(input[index]);
- index++;
- let days = 5;
- let savings = (days * pocketCash) + (days * earnedCash) - expenses;
- if (savings >= giftPrice) {
- console.log(`Profit: ${savings.toFixed(2)} BGN, the gift has been purchased.`);
- } else {
- console.log(`Insufficient money: ${(giftPrice - savings).toFixed(2)} BGN.`);
- }
- }
- braceletStand(["5.12", "32.05", "15", "150"]);
Advertisement
Add Comment
Please, Sign In to add comment