public void createDepartureFlight() { for (int j = 0; j < 4; j++) { int destinationairportid = j; double distribution = flightdistribution[0, j]; int arrivaltime = currenttime + flyhours[destinationairportid, airportid]; int passengersinflight = Convert.ToInt32(distribution * totalpassengers); bool returned = false; if (passengersinflight > 0) { flight f = new flight(currenttime, arrivaltime, airportid, destinationairportid, passengersinflight, returned); ScheduleDepartureFlight(f, returned); } } }
public void ScheduleDepartureFlight(flight flight, Boolean returnedflight) { if (returnedflight) { flight f = flight; flight.departAirport = airportid; flight.ArrivalAirport = f.departAirport; flight.departtime = currenttime; flight.arrivaltime = flight.departtime + flyhours[flight.departAirport, flight.ArrivalAirport]; flight.returningflight = true; } // get another instance of airport object Airport arrivalairport = airports[flight.ArrivalAirport]; //add to the arrival list of this airport. arrivalairport.AddFlightsToQueue(arrivalairport, flight.arrivaltime - flight.departtime, flight); totalpassengers -= flight.numberofpassengers; }
public void processArrivalFlight(flight flight) { totalpassengers = totalpassengers + flight.numberofpassengers; }