Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _01.SoftUniAirlines
- {
- class softUniArilines
- {
- static void Main(string[] args)
- {
- //• adult passengers count
- //• adult ticket price
- //• youth passengers count
- //• youth ticket price
- //• fuel price per hour
- //• fuel consumption per hour
- //• flight duration
- int cnt = int.Parse(Console.ReadLine());
- decimal lost = 0;
- decimal profit = 0;
- for (int i = 0; i <cnt; i++)
- {
- long adultPassengers = long.Parse(Console.ReadLine());
- decimal adultTicketPrice = decimal.Parse(Console.ReadLine());
- long youthPassengers = long.Parse(Console.ReadLine());
- decimal youthTicket = decimal.Parse(Console.ReadLine());
- decimal fuelPrice = decimal.Parse(Console.ReadLine());
- decimal fuelConsumptioPerH = decimal.Parse(Console.ReadLine());
- int flightDuration = int.Parse(Console.ReadLine());
- decimal totalTickets = (adultPassengers * adultTicketPrice) + (youthPassengers * youthTicket);
- decimal priceOfFlight = fuelConsumptioPerH * flightDuration * fuelPrice;
- if (totalTickets>=priceOfFlight)
- {
- profit += totalTickets - priceOfFlight;
- Console.WriteLine($"You are ahead with {profit:f3}$.");
- }
- else
- {
- lost +=totalTickets- priceOfFlight ;
- Console.WriteLine($"We've got to sell more tickets! We've lost {lost:f3}$.");
- }
- }
- decimal overall = profit + lost;
- Console.WriteLine($"Overall profit -> { overall:f3}$.");
- Console.WriteLine($"Average profit -> { overall / cnt:f3}$.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement