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 SoftUni_Airline
- {
- class Airline
- {
- static void Main(string[] args)
- {
- int numberOfFlights = int.Parse(Console.ReadLine());
- int adultPassengersCount = 0;
- decimal adultTicketPrice = 0;
- int youthPassengersCount = 0;
- decimal youthTicketPrice = 0;
- decimal fuelPricePerHour = 0;
- decimal fuelConsumptionPerHour = 0;
- int flightDuration = 0;
- decimal income = 0;
- decimal expenses = 0;
- decimal profit = 0;
- decimal overallProfit = 0;
- decimal averageProfit = 0;
- for (int flight = 0; flight < numberOfFlights; flight++)
- {
- adultPassengersCount = int.Parse(Console.ReadLine());
- adultTicketPrice = decimal.Parse(Console.ReadLine());
- youthPassengersCount = int.Parse(Console.ReadLine());
- youthTicketPrice = decimal.Parse(Console.ReadLine());
- fuelPricePerHour = decimal.Parse(Console.ReadLine());
- fuelConsumptionPerHour = decimal.Parse(Console.ReadLine());
- flightDuration = int.Parse(Console.ReadLine());
- income = (adultPassengersCount * adultTicketPrice) + (youthPassengersCount * youthTicketPrice);
- expenses = flightDuration * fuelConsumptionPerHour * fuelPricePerHour;
- profit = income - expenses;
- overallProfit += profit;
- if (profit >= 0)
- {
- Console.WriteLine($"You are ahead with {profit:f3}$.");
- }
- else
- {
- Console.WriteLine($"We've got to sell more tickets! We've lost {profit:f3}$.");
- }
- }//end of for
- averageProfit = overallProfit / numberOfFlights;
- Console.WriteLine($"Overall profit -> {overallProfit:f3}$.");
- Console.WriteLine($"Average profit -> {averageProfit:f3}$.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement