static void PlanesCanFly(IAirline airline, FlightParams flightParams) { IFlightPreparer preparer = new FlightDirector(flightParams); Console.WriteLine("\n\tFlight parameters:\n"); Console.WriteLine("Flight range: {0}", flightParams.FlightRange); Console.WriteLine("Passengers count: {0}", flightParams.PassgengersCount); Console.WriteLine("Cargo weight: {0}", flightParams.CargoWeight); Console.WriteLine("\n\tPlanes can make this flight:\n"); var canFlyPlanes = airline.Planes;//.Where(p => preparer.CanFly(p)); Console.WriteLine("-------------------------------"); foreach (var plane in canFlyPlanes) { Console.WriteLine(plane.ToString()); if (plane.PrepareForFlight(preparer)) { Console.WriteLine("Flight begins.."); string flightMessage; plane.Flight(out flightMessage); Console.WriteLine(flightMessage); Console.WriteLine(); } else { Console.WriteLine(preparer.LastResult); Console.WriteLine(); } Console.WriteLine("-------------------------------"); } }
static void WritePassengersPlanes(IAirline airline) { Console.WriteLine("\n\tPassengers planes:\n"); foreach (var plane in airline.PassengersPlanes()) { Console.WriteLine(plane.ToString()); } }
static void WritePlanes(IAirline airline) { Console.WriteLine("\n\tAirline planes:\n"); foreach (var plane in airline.Planes) { Console.WriteLine(plane.ToString()); } }
static void WriteFlightDemo(IAirline airline) { FlightParams flightParams; flightParams.FlightRange = 750; flightParams.PassgengersCount = 40; flightParams.CargoWeight = 300; PlanesCanFly(airline, flightParams); }
static void WritePlanesByFuelConsumption(IAirline airline, double minValue, double maxValue) { Console.WriteLine(); Console.WriteLine("\tPlanes with fuel consumption in [{0}, {1}]:\n", minValue, maxValue); foreach (var plane in airline.FindByFuelConsumption(minValue, maxValue)) { Console.WriteLine(plane.ToString()); } }
static void Main(string[] args) { IAirline airline = CreateAirline(); WriteAirlineSkills(airline); WritePlanes(airline); WritePassengersPlanes(airline); WritePlanesByFuelConsumption(airline, 30, 50); WriteFlightDemo(airline); Console.Write("Any key to exit."); Console.ReadKey(); }
public FlightController(IFlight flight, IDetail detail, IAirPlane airPlane, IAirPort airPort, IFlightStatus flightStatus, IGate gate, IWeather weather, ITypeDetail typeDetail, ICustomer customer, ICustomerFlight customerFlight, IAirline airline, ICity city, IAddress address) { _flight = flight; _detail = detail; _airPlane = airPlane; _airport = airPort; _flightStatus = flightStatus; _gate = gate; _Weatger = weather; _TypeDetail = typeDetail; _customer = customer; _customerFlight = customerFlight; _airline = airline; _city = city; _address = address; }
static void Main(string[] args) { IAirline MyAirline = CreateFromFactory(); IAirline MyBelavia = CreateFromBuilder(); Console.WriteLine("Общая вместимость флота компании {0} чел.", MyAirline.GetSummaryPeople()); Console.WriteLine("Общая грузоподъемность авиакомпании {0} т.", MyAirline.GetSummaryCarrying()); Console.WriteLine("Сортировка по дальности полета: "); foreach (var item in MyAirline.SortByRange()) { Console.WriteLine(" {0} имеет дальность полета {1} км.", item.Name, item.Range); } Console.WriteLine("________________________________"); foreach (var item in MyAirline.SearchByFuel(0.94, 1.01)) { Console.WriteLine("{0} в диапазоне данного потребления горючего.", item.Name); } Console.ReadKey(); }
public AirlineController(IAirline airline, IDetail detail) { _airline = airline; _detail = detail; }
static void WriteAirlineSkills(IAirline airline) { Console.WriteLine("\n\tAirline capacities:"); Console.WriteLine("\nTotal cargo: {0}\nTotal passengers: {1}\n\n", airline.TotalCargoCapacity, airline.TotalPassengersCapacity); }
public void ShowAirline(IAirline airline) { // ............. }