Advertisement
Guest User

Untitled

a guest
Jun 16th, 2016
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 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. using System.Numerics;
  7.  
  8. namespace SoftUniAirLine
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int n = int.Parse(Console.ReadLine());
  15. List<decimal> overAllProfit = new List<decimal>();
  16. for (int i = 0; i < n; i++)
  17. {
  18.  
  19.  
  20. int adultPassengersCount = int.Parse(Console.ReadLine());
  21. decimal adultTicketPrize = decimal.Parse(Console.ReadLine());
  22. int youthPassengerCount = int.Parse(Console.ReadLine());
  23. decimal youthTicketPrize = decimal.Parse(Console.ReadLine());
  24. decimal prizePerHour = decimal.Parse(Console.ReadLine());
  25. decimal fuelConsumption = decimal.Parse(Console.ReadLine());
  26. int flightDuration = int.Parse(Console.ReadLine());
  27.  
  28. decimal income = (adultPassengersCount * adultTicketPrize) + (youthPassengerCount * youthTicketPrize);
  29. decimal expenses = flightDuration * fuelConsumption * prizePerHour;
  30. decimal profit = income - expenses;
  31. overAllProfit.Add(profit);
  32. if (profit >= 0)
  33. {
  34. Console.WriteLine("You are ahead with {0:f3}$.", profit);
  35. }
  36. else
  37. {
  38. Console.WriteLine(" We've got to sell more tickets! We've lost {0:f3}$.", profit);
  39. }
  40.  
  41. }
  42.  
  43. Console.WriteLine("Overall profit -> {0:f3}$.", overAllProfit.Sum());
  44. Console.WriteLine("Average profit -> {0:f3}$.", overAllProfit.Sum() / n);
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement