Exemplo n.º 1
0
        static void Main(string[] args)
        {
            bool elevator1IsOverMaxCapacity;

            Elevator elevator1 = new Elevator(2, 400);
            Passenger A1 = new Passenger("A1", 180);
            elevator1.AddOccupant(0, A1);
            Passenger A2 = new Passenger("A2", 220);
            elevator1.AddOccupant(1, A2);
            elevator1.GetCurrentWeight();
            elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();

            bool elevator2IsOverMaxCapacity;

            Elevator elevator2 = new Elevator(3, 600);
            A1 = new Passenger("A1", 200);
            elevator2.AddOccupant(0, A1);
            A2 = new Passenger("A2", 200);
            elevator2.AddOccupant(1, A2);
            Passenger A3 = new Passenger("A3", 201);
            elevator2.AddOccupant(2, A3);
            elevator2.GetCurrentWeight();
            elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();

            System.Console.Read();

            //Step 3 – In Your Main Program:
            // Declare a local variable named elevator1 which is an Elevator.
            // Instantiate elevator1, with a maxOccupants of 2, and a maxWeight of 400.
            // AddOccupant to elevator1, with a name of “A1”, weight of 180, and index of 0.
            // AddOccupant to elevator1, with a name of “A2”, weight of 220, and index of 1.
            // Declare a local variable named elevator1IsOverMaxCapacity which is a bool.
            // Assign elevator1IsOverMaxCapacity the value of IsOverMaxCapacity for elevator1.
            // Debug your program to make sure the value of elevator1IsOverMaxCapacity is false.
            // Declare a local variable named elevator2 which is an Elevator.
            // Instantiate elevator2, with a maxOccupants of 3, and a maxWeight of 600.
            // AddOccupant to elevator2, with a name of “A1”, weight of 200, and index of 0.
            // AddOccupant to elevator2, with a name of “A2”, weight of 200, and index of 1.
            // AddOccupant to elevator2, with a name of “A3”, weight of 201, and index of 2.
            // Declare a local variable named elevator2IsOverMaxCapacity which is a bool.
            // Assign elevator2IsOverMaxCapacity the value of IsOverMaxCapacity for elevator2.
            // Debug your program to make sure the value of elevator2IsOverMaxCapacity is true
        }
Exemplo n.º 2
0
 public void AddOccupant(int index, Passenger passenger)
 {
     Occupants[index] = passenger;
 }
Exemplo n.º 3
0
 public void AddOccupant(int index, Passenger passenger)
 {
     Occupants[index] = passenger;
 }