示例#1
0
        static void Main(string[] args)
        {
            #region elevator1Logic

                Elevator elevator1 = new Elevator(2,400);           // ** creates a new instance of Elevator called elevator1 **

                Passenger a1 = new Passenger("A1", 180);            // ** creates a new Passenger called a1 **
                elevator1.AddOccupant(a1, 0);                       // ** adds Passenger a1 to elevator1's occupants (index 0) **

                elevator1.AddOccupant(new Passenger("A2", 220), 1); // ** creates a new Passenger, sets the values & adds it to elevator1's occupants (index 1) **

                bool elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity(); //** determines if the passenger weight of elevator1 is over its capacity **

            #endregion elevator1Logic

            #region elevator2Logic

                Elevator elevator2 = new Elevator(3, 600);          //  ** creates a new instance of Elevator called elevator2 **

                elevator2.AddOccupant(new Passenger("A1", 200), 0); //  ** creates a new Passenger, sets the values & adds it to elevator2's occupants (index 0) **
                elevator2.AddOccupant(new Passenger("A2", 200), 1); //  ** creates a new Passenger, sets the values & adds it to elevator2's occupants (index 1) **
                elevator2.AddOccupant(new Passenger("A3", 201), 2); //  ** creates a new Passenger, sets the values & adds it to elevator2's occupants (index 2) **

                bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity(); //** determines if the passenger weight of elevator2 is over its capacity **

            #endregion elevator2Logic
        }
示例#2
0
        static void Main(string[] args)
        {
            Elevator elevator1 = new Elevator(2, 400);

            elevator1.AddOccupant((new Passenger("A1", 180)), 0);
            elevator1.AddOccupant((new Passenger("A2", 220)), 1);
            bool     elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();
            Elevator elevator2 = new Elevator(3, 600);

            elevator2.AddOccupant((new Passenger("A1", 200)), 0);
            elevator2.AddOccupant((new Passenger("A2", 200)), 1);
            elevator2.AddOccupant((new Passenger("A3", 201)), 2);
            bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();
        }
示例#3
0
        static void Main(string[] args)
        {
            Elevator elevator1 = new Elevator(2, 400);
            elevator1.AddOccupant(new Passenger("A1", 180), 0);
            elevator1.AddOccupant(new Passenger("A2", 220), 1);

            bool elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();

            /////////////////////////////////////////////////////////////////////////////

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

            bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();
        }
示例#4
0
        static void Main(string[] args)
        {
            Elevator elevator1 = new Elevator(2, 400);

            elevator1.AddOccupant((new Passenger("A1", 180)), 0);
            elevator1.AddOccupant((new Passenger("A2", 220)), 1);
            bool elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();
            //debug shows value of bool as false for elevator1

            Elevator elevator2 = new Elevator(3, 600);

            elevator2.AddOccupant((new Passenger("A1", 200)), 0);
            elevator2.AddOccupant((new Passenger("A2", 200)), 1);
            elevator2.AddOccupant((new Passenger("A3", 201)), 2);
            bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();
            //debug shows value of bool is true for elevator2
        }
示例#5
0
        static void Main(string[] args)
        {
            // ELEVATOR #1
            Elevator elevator1 = new Elevator(2, 400);
            Passenger A1 = new Passenger("A1", 180);
            elevator1.AddOccupant(A1, 0);
            //System.Console.WriteLine("1Elevator 1 weight: " + elevator1.GetCurrentWeight());

            Passenger A2 = new Passenger("A2", 220);
            elevator1.AddOccupant(A2, 1);
            //System.Console.WriteLine("2Elevator 1 weight: " + elevator1.GetCurrentWeight());

            bool elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();
            //System.Console.WriteLine("Elevator 1 is Overweight: " + elevator1IsOverMaxCapacity);
            //System.Console.WriteLine("Elevator 1 weight: " + elevator1.GetCurrentWeight());


            // ELEVATOR #2
            Elevator elevator2 = new Elevator(3, 600);
            Passenger A3 = new Passenger("A1", 200);
            elevator2.AddOccupant(A3, 0);
            //System.Console.WriteLine("1Elevator 2 weight: " + elevator2.GetCurrentWeight());
            Passenger A4 = new Passenger("A2", 200);
            elevator2.AddOccupant(A4, 1);
            //System.Console.WriteLine("2Elevator 2 weight: " + elevator2.GetCurrentWeight());
            Passenger A5 = new Passenger("A3", 201);
            elevator2.AddOccupant(A5, 2);
            //System.Console.WriteLine("3Elevator 2 weight: " + elevator2.GetCurrentWeight());
            bool elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();

            System.Console.WriteLine("Elevator 1 is Overweight: " + elevator1IsOverMaxCapacity);
            System.Console.WriteLine("Elevator 2 is Overweight: " + elevator2IsOverMaxCapacity);
            System.Console.WriteLine("Elevator 1 weight: " + elevator1.GetCurrentWeight());
            System.Console.WriteLine("Elevator 2 weight: " + elevator2.GetCurrentWeight());

            System.Console.Read();




        }
示例#6
0
        static void Main(string[] args)
        {
            bool elevator1IsOverMaxCapacity;
            bool elevator2IsOverMaxCapacity;

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

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

            elevator1IsOverMaxCapacity = elevator1.IsOverMaxCapacity();
            elevator2IsOverMaxCapacity = elevator2.IsOverMaxCapacity();
        }