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;
- using System.Numerics;
- namespace SoftUniAirLine
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- List<decimal> overAllProfit = new List<decimal>();
- for (int i = 0; i < n; i++)
- {
- int adultPassengersCount = int.Parse(Console.ReadLine());
- decimal adultTicketPrize = decimal.Parse(Console.ReadLine());
- int youthPassengerCount = int.Parse(Console.ReadLine());
- decimal youthTicketPrize = decimal.Parse(Console.ReadLine());
- decimal prizePerHour = decimal.Parse(Console.ReadLine());
- decimal fuelConsumption = decimal.Parse(Console.ReadLine());
- int flightDuration = int.Parse(Console.ReadLine());
- decimal income = (adultPassengersCount * adultTicketPrize) + (youthPassengerCount * youthTicketPrize);
- decimal expenses = flightDuration * fuelConsumption * prizePerHour;
- decimal profit = income - expenses;
- overAllProfit.Add(profit);
- if (profit >= 0)
- {
- 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}$.", overAllProfit.Sum());
- Console.WriteLine("Average profit -> {0:f3}$.", overAllProfit.Sum() / n);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement