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 SoftUniAirLine
- {
- class SoftUniAirLine
- {
- static void Main()
- {
- int flights = int.Parse(Console.ReadLine());
- decimal totalProfit = 0;
- for (int i = 0; i < flights; i++)
- {
- int audultPassengersCount = int.Parse(Console.ReadLine());
- decimal adultticketPRice = decimal.Parse(Console.ReadLine());
- int youthPassengersCount = int.Parse(Console.ReadLine());
- decimal youthTicketPrice = decimal.Parse(Console.ReadLine());
- decimal fuelPricePerHour = decimal.Parse(Console.ReadLine());
- decimal fuelConsumationPerHour = decimal.Parse(Console.ReadLine());
- int flightDuration = int.Parse(Console.ReadLine());
- decimal incomeProfit = (audultPassengersCount * adultticketPRice) + (youthPassengersCount * youthTicketPrice);
- decimal expenses = (flightDuration * fuelConsumationPerHour * fuelPricePerHour);
- decimal profit = incomeProfit - expenses;
- totalProfit += profit;
- if(incomeProfit >= expenses)
- {
- Console.WriteLine("You are ahead with {0:F3}$.",profit);
- }
- else
- {
- Console.WriteLine("We`ve got to sell more tickets! We`ve lost {0:F3}$",profit);
- }
- }
- Console.WriteLine("Overall profit -> {0:F3}",totalProfit);
- Console.WriteLine("Average profit -> {0:F3}",totalProfit/flights);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement