TZinovieva

Agency Profit

Jun 12th, 2022
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function agencyProfit(input) {
  2.     let company = input[0];
  3.     let adultTickets = Number(input[1]);
  4.     let kidsTickets = Number(input[2]);;
  5.     let adultPrice = Number(input[3]);
  6.     let fee = Number(input[4]);
  7.  
  8.     let kidPrice = adultPrice * 0.30;
  9.  
  10.     let soldTickets = (adultTickets * adultPrice + adultTickets * fee) + kidsTickets * kidPrice + kidsTickets * fee;
  11.     let profit = soldTickets * 0.20;
  12.  
  13.     console.log(`The profit of your agency from ${company} tickets is ${(profit).toFixed(2)} lv.`);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment