static void Main(string[] args) { Passenger p1 = new Passenger("A1",180); Passenger p2 = new Passenger("A2", 220); Elevator elevator1 = new Elevator(2, 400); elevator1.AddOccupant(p1, 0); elevator1.AddOccupant(p2, 1); bool elevator1IsOverMaxCapacity; elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity(); Elevator elevator2 = new Elevator(3,600); Passenger p3 = new Passenger("A1", 200); Passenger p4 = new Passenger("A2", 200); Passenger p5 = new Passenger("A3", 201); elevator2.AddOccupant(p3, 0); elevator2.AddOccupant(p4, 1); elevator2.AddOccupant(p5, 2); bool elevator2IsOverMaxCapacity; elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity(); }
static void Main(string[] args) { bool elevator1IsOverMaxCapacity; Elevator elevator1; elevator1 = new Elevator(2, 400); Passenger person1 = new Passenger("A1", 180); elevator1.AddOccupants(person1, 0); Passenger person2 = new Passenger("A2", 200); elevator1.AddOccupants(person2, 1); elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity(); bool elevator2IsOverMaxCapacity; Elevator elevator2; elevator2 = new Elevator(3, 600); Passenger person3 = new Passenger("A1", 200); elevator2.AddOccupants(person3, 0); Passenger person4 = new Passenger("A2", 200); elevator2.AddOccupants(person4, 1); Passenger person5 = new Passenger("A3", 201); elevator2.AddOccupants(person5, 2); elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity(); }
public void AddOccupant(Passenger passenger, int index) { Occupant[index] = passenger; }
public void AddOccupant(Passenger passenger, int index) { Occupants[index] = passenger; }