Example #1
0
        static void Main(string[] args)
        {
            var inputToCreateParkingLot = Console.ReadLine().Split(" ");
            int numslots = Int32.Parse(inputToCreateParkingLot[1]);

            ParkingLot parkingLot        = new ParkingLot(numslots);
            bool       parkingLotOperate = true;

            //input driver
            //stop using Stop input
            while (parkingLotOperate)
            {
                var inputsForParkingLot1 = Console.ReadLine().Split(" ");
                if (inputsForParkingLot1[0] == "park")
                {
                    string registrationNumber = inputsForParkingLot1[1];
                    string color = inputsForParkingLot1[2];
                    parkingLot.AllocateParkingSlot(registrationNumber, color);
                }

                if (inputsForParkingLot1[0] == "leave")
                {
                    int slotNumberToLeave = Int32.Parse(inputsForParkingLot1[1]);
                    parkingLot.LeaveParkingSlot(slotNumberToLeave);
                }

                if (inputsForParkingLot1[0] == "Status")
                {
                    parkingLot.ParkingLotStatus();
                }

                if (inputsForParkingLot1[0] == "registration_numbers_for_cars_with_colour")
                {
                    string color = inputsForParkingLot1[1];
                    parkingLot.PrintRegistrationNumberOfCarsWithGivenColor(color);
                }

                if (inputsForParkingLot1[0] == "slot_numbers_for_cars_with_colour")
                {
                    string color = inputsForParkingLot1[1];
                    parkingLot.PrintSlotNumberForCarsWithGivenColor(color);
                }

                if (inputsForParkingLot1[0] == "slot_number_for_registration_number")
                {
                    string regsNum = inputsForParkingLot1[1];
                    parkingLot.PrintSlotNumberForRegistrationNumber(regsNum);
                }

                if (inputsForParkingLot1[0] == "Stop")
                {
                    parkingLotOperate = false;
                }
            }
        }