Advertisement
NedyalkoKikov

SoftUniAirLine

Jun 11th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace SoftUniAirLine
  8. {
  9. class SoftUniAirLine
  10. {
  11. static void Main()
  12. {
  13. int flights = int.Parse(Console.ReadLine());
  14. decimal totalProfit = 0;
  15. for (int i = 0; i < flights; i++)
  16. {
  17. int audultPassengersCount = int.Parse(Console.ReadLine());
  18. decimal adultticketPRice = decimal.Parse(Console.ReadLine());
  19. int youthPassengersCount = int.Parse(Console.ReadLine());
  20. decimal youthTicketPrice = decimal.Parse(Console.ReadLine());
  21. decimal fuelPricePerHour = decimal.Parse(Console.ReadLine());
  22. decimal fuelConsumationPerHour = decimal.Parse(Console.ReadLine());
  23. int flightDuration = int.Parse(Console.ReadLine());
  24.  
  25. decimal incomeProfit = (audultPassengersCount * adultticketPRice) + (youthPassengersCount * youthTicketPrice);
  26. decimal expenses = (flightDuration * fuelConsumationPerHour * fuelPricePerHour);
  27. decimal profit = incomeProfit - expenses;
  28. totalProfit += profit;
  29. if(incomeProfit >= expenses)
  30. {
  31. Console.WriteLine("You are ahead with {0:F3}$.",profit);
  32. }
  33. else
  34. {
  35. Console.WriteLine("We`ve got to sell more tickets! We`ve lost {0:F3}$",profit);
  36. }
  37.  
  38. }
  39. Console.WriteLine("Overall profit -> {0:F3}",totalProfit);
  40. Console.WriteLine("Average profit -> {0:F3}",totalProfit/flights);
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement