Exemple #1
0
        static void Main(string[] args)
        {
            Elevator elevator1 = new Elevator(2, 400);
            Passenger passenger = new Passenger("A1", 180);
            elevator1.AddOccupant(passenger, 0);
            Passenger passenger1 = new Passenger("A2", 220);
            elevator1.AddOccupant(passenger1, 1);
            bool elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity(); //must be false
            System.Console.WriteLine("Elevator1 is over max capacity? " + elevator1IsOverMaxCapacity);

            Elevator elevator2 = new Elevator(3,600);
            Passenger passenger2 = new Passenger("A1", 200);
            elevator2.AddOccupant(passenger2, 0);
            Passenger passenger3 = new Passenger("A2", 200);
            elevator2.AddOccupant(passenger3, 1);
            Passenger passenger4 = new Passenger("A3", 201);
            elevator2.AddOccupant(passenger4, 2);
            bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity(); //must be true
            System.Console.WriteLine("Elevator2 is over max capacity? " + elevator2IsOverMaxCapacity);
            System.Console.ReadKey();
        }
Exemple #2
0
 public void AddOccupant(Passenger passenger, int index)
 {
     Occupants[index] = passenger;
 }
Exemple #3
0
 public void AddOccupant(Passenger passenger, int index)
 {
     Occupants[index] = passenger;
 }