Advertisement
Spocoman

Agency Profit

Feb 16th, 2022
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function agencyProfit(input) {
  2.     let agency = input[0];
  3.     let ticket = Number(input[1]);
  4.     let kidTicket = Number(input[2]);
  5.     let ticketPrice = Number(input[3]);
  6.     let service = Number(input[4]);
  7.  
  8.     let totalAdult = (ticketPrice + service) * ticket;
  9.     let totalKid = (0.3 * ticketPrice + service) * kidTicket;
  10.     let total = (totalAdult + totalKid) / 5;
  11.  
  12.     console.log(`The profit of your agency from ${agency} tickets is ${total.toFixed(2)} lv.`);
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement