//public ConstructFlight() //fill in default test data. This would obviously be taken out after the prototype phase private void FillFlightData() { //declare and instantiate Flights //flight 1 tmpFlight = new Flight(); tmpFlight.FlightNumber = 700; tmpFlight.OriginLocation = "Seattle"; tmpFlight.DestinationLocation = "Phoenix"; FlightArray[Flight.FlightCount - 1] = tmpFlight; tmpFlight = new Flight(); tmpFlight.FlightNumber = 600; tmpFlight.OriginLocation = "Chicago"; tmpFlight.DestinationLocation = "New York"; FlightArray[Flight.FlightCount - 1] = tmpFlight; tmpFlight = new Flight(); tmpFlight.FlightNumber = 500; tmpFlight.OriginLocation = "Phoenix"; tmpFlight.DestinationLocation = "San Diego"; FlightArray[Flight.FlightCount - 1] = tmpFlight; tmpFlight = new Flight(); tmpFlight.FlightNumber = 656; tmpFlight.OriginLocation = "Denver"; tmpFlight.DestinationLocation = "Austin"; FlightArray[Flight.FlightCount -1] = tmpFlight; }
public void AddFlight() { Flight tmpFlight; //variable that temporarily stores flight input string strFlightNumber; //we create this because when we instiantiate a new object, we need a parameter input (look at the Flight.cs's overloaded constructor) Console.Write("Enter Flight Number:"); strFlightNumber = Console.ReadLine(); //initialize temporary flight object tmpFlight = new Flight(strFlightNumber); Console.Write("Enter Origin: "); //Write Origin in the instantiated object tmpFlight.Origin = Console.ReadLine(); Console.Write("Enter Destination: "); //write the destination to the instantiated object tmpFlight.Destination = Console.ReadLine(); FlightArray[intNumOfFlights] = tmpFlight; //this needs code that returns the screen to NeatsMainMenu. I tried to use the other way we did for the Customerstuff we did in 340, but I don't think it will work in console. }