Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nikola-Andreev/aae5fb0dd594726754943f96c49ad3fa to your computer and use it in GitHub Desktop.
Save Nikola-Andreev/aae5fb0dd594726754943f96c49ad3fa to your computer and use it in GitHub Desktop.
01. Softuni Airlines
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
using System.Globalization;
using System.Text.RegularExpressions;
using System.Threading;
class Programa
{
static void Main(string[] args)
{
int numberOfFly = int.Parse(Console.ReadLine());
decimal overAllPrqofit = 0;
decimal avergeProfit = 0;
for (int i = 0; i < numberOfFly; i++)
{
int adultPas = int.Parse(Console.ReadLine());
decimal adultTicketPrice = decimal.Parse(Console.ReadLine());
int youngPas = int.Parse(Console.ReadLine());
decimal youngTicketPrice = decimal.Parse(Console.ReadLine());
decimal fuelPricePerHour = decimal.Parse(Console.ReadLine());
double fuelLess = double.Parse(Console.ReadLine());
double duration = double.Parse(Console.ReadLine());
decimal myIncome = ((adultPas * adultTicketPrice) + (youngPas * youngTicketPrice));
decimal expenses = (fuelPricePerHour * (decimal)(fuelLess * duration));
decimal profit = (decimal)(myIncome - expenses);
overAllPrqofit += profit;
avergeProfit = overAllPrqofit / numberOfFly;
if (myIncome >= 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}$.", overAllPrqofit);
Console.WriteLine("Average profit -> {0:f3}$.", avergeProfit);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment