Advertisement
-Enigmos-

excursion.js

Oct 25th, 2021
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function excursion(input) {
  2.     let index = 0;
  3.     let tourists = Number(input[index]);
  4.     index++;
  5.     let nights = Number(input[index]);
  6.     index++;
  7.     let maps = Number(input[index]);
  8.     index++;
  9.     let tickets = Number(input[index]);
  10.     index++;
  11.     let nightPrice = 20;
  12.     let mapPrice = 1.60;
  13.     let ticketPrice = 6;
  14.     let expenses = 0.25;
  15.  
  16.     let touristCosts = (nights * nightPrice) + (maps * mapPrice) + (tickets * ticketPrice);
  17.     let groupCosts = tourists * touristCosts;
  18.     let total = groupCosts + (groupCosts * expenses);
  19.  
  20.     console.log(total.toFixed(2));
  21. }
  22.  
  23. excursion(["20", "14", "30", "6"]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement