Exemplo n.º 1
0
        private void btnIncreaseAge_Click(object sender, EventArgs e)
        {
            int   pilotNumber = Convert.ToInt32(tbPilotNumber.Text);
            Pilot pilot       = airlines.FindPilot(pilotNumber);

            if (pilot != null)
            {
                pilot.Age++;
            }
            else
            {
                MessageBox.Show("There are no pilots with this number!");
            }
            ShowPilots();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates several "fake" pilots and adds them to the airlines object.
        /// </summary>
        private void CreateFakePilots()
        {
            Pilot pilot = new Pilot("John Perry", 30);

            //   pilot.OnFullCapacity += this.PilotCapacityFull;
            pilot.AddFlight(110);
            pilot.AddFlight(60);
            airlines.AddPilot(pilot);

            pilot = new Pilot("Ann Smiths", 40);
            // pilot.OnFullCapacity += this.PilotCapacityFull;
            pilot.AddFlight(75);
            airlines.AddPilot(pilot);

            pilot = new Pilot("Joe Jefferson", 33);
            //  pilot.OnFullCapacity += this.PilotCapacityFull;
            pilot.AddFlight(120);
            airlines.AddPilot(pilot);

            pilot = new Pilot("Jack Gibbs", 45);
            //  pilot.OnFullCapacity += this.PilotCapacityFull;
            pilot.AddFlight(90);
            airlines.AddPilot(pilot);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Removes one pilot for the airlines.
 /// </summary>
 /// <param name="pilot"></param>
 public void RemovePilot(Pilot pilot)
 {
     pilots.Remove(pilot);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Add a new pilot to the airlines.
 /// </summary>
 /// <param name="pilot">The pilot that should be added.</param>
 public void AddPilot(Pilot pilot)
 {
     pilots.Add(pilot);
 }
Exemplo n.º 5
0
 public Node(Pilot pilot)
 {
     this.pilot = pilot;
     this.next  = null;
 }
Exemplo n.º 6
0
 private void PilotCapacityFull(Pilot pilot, int overHours)
 {
     MessageBox.Show("Pilot " + pilot.Name + " has full capacity and will be removed from the list!\nHe/she now has " + pilot.FlightHours + " flight hours, and that is " + overHours + " hours of over work!");
     airlines.RemovePilot(pilot);
     ShowPilots();
 }