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 Program
- {
- static void Main(string[] args)
- {
- double flights = double.Parse(Console.ReadLine());
- for (int i = 0; i < flights; i++)
- {
- int adultPassCount = int.Parse(Console.ReadLine());
- int youngPassCount = int.Parse(Console.ReadLine());
- double adultTicketPrice = double.Parse(Console.ReadLine());
- double youngTicketPrice = double.Parse(Console.ReadLine());
- double fuelPricePerHour = double.Parse(Console.ReadLine());
- double fuelConsPerHour = double.Parse(Console.ReadLine());
- //income & outcome
- double income = (adultPassCount * adultTicketPrice) + (youngPassCount * youngTicketPrice);
- double outcome = fuelPricePerHour * fuelConsPerHour * flights;
- //profit
- double profit = income - outcome;
- double 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}", avgProfit + "$.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement