Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function safari(input) {
- let budget = Number(input[0]);
- let fuelQty = Number(input[1]);
- let day = input[2];
- let fuelPrice = fuelQty * 2.10;
- let totalPrice = fuelPrice + 100;
- if (day === "Saturday") {
- totalPrice -= totalPrice * 0.10;
- } else if (day === "Sunday") {
- totalPrice -= totalPrice * 0.20;
- }
- if (budget > totalPrice) {
- console.log(`Safari time! Money left: ${(budget - totalPrice).toFixed(2)} lv.`);
- } else {
- console.log(`Not enough money! Money needed: ${(totalPrice - budget).toFixed(2)} lv.`);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment