Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function excursion(input) {
- let index = 0;
- let tourists = Number(input[index]);
- index++;
- let nights = Number(input[index]);
- index++;
- let maps = Number(input[index]);
- index++;
- let tickets = Number(input[index]);
- index++;
- let nightPrice = 20;
- let mapPrice = 1.60;
- let ticketPrice = 6;
- let expenses = 0.25;
- let touristCosts = (nights * nightPrice) + (maps * mapPrice) + (tickets * ticketPrice);
- let groupCosts = tourists * touristCosts;
- let total = groupCosts + (groupCosts * expenses);
- console.log(total.toFixed(2));
- }
- excursion(["20", "14", "30", "6"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement