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 Program
- {
- static void Main(string[] args)
- {
- int flights = int.Parse(Console.ReadLine());
- for (int i = 0; i < flights; i++)
- {
- int youngPassCount = int.Parse(Console.ReadLine());
- int adultPassCount = int.Parse(Console.ReadLine());
- decimal youngTicketPrice = decimal.Parse(Console.ReadLine());
- decimal adultTicketPrice = decimal.Parse(Console.ReadLine());
- decimal fuelPricePerHour = decimal.Parse(Console.ReadLine());
- decimal fuelConsPerHour = decimal.Parse(Console.ReadLine());
- int flightDuration = int.Parse(Console.ReadLine());
- //income & outcome
- decimal income = (adultPassCount * adultTicketPrice) + (youngPassCount * youngTicketPrice);
- decimal outcome = fuelPricePerHour * fuelConsPerHour * flightDuration;
- //profit
- decimal profit = income - outcome;
- decimal avgProfit = profit / flights;
- if (profit > 0)
- { Console.WriteLine("You're ahead with {0:f3}$", profit); }
- else if (profit <= 0)
- { Console.WriteLine("We've got to sell more tickets! We've lost {0:f3}$", profit); }
- Console.WriteLine("Overall profit -> {0:f3}$", profit);
- Console.WriteLine("Average profit -> {0:f3}$", profit / flightDuration);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment