コード例 #1
0
        static void Main()
        {
            Menu menu = new Menu();
            Garage garage = new Garage();
            bool isStillRunning = true;

            do
            {
                switch (menu.ShowMenuToTheUserAndReturnSelectedIndex())
                {
                    case 1:
                        {
                            AddParkingLotsToGarage(garage);
                            break;
                        }
                    case 2:
                        {
                            CreateAndParkANewCarInTheGarage(garage);
                            break;
                        }
                    case 3:
                        {
                            garage.WriteGarageLayoutToTheUser();
                            break;
                        }
                    case 4:
                        {
                            isStillRunning = CheckIfTheUserWantsToCloseTheApplication();
                            break;
                        }
                }

            } while (isStillRunning);
           
        }
コード例 #2
0
 private static void AddParkingLotsToGarage(Garage garage)
 {
     Console.Write("Enter number of parking lots: ");
     var numberOfParkingLotsInput = Console.ReadLine();
     var numberOfParkingLots = Convert.ToInt32(numberOfParkingLotsInput);
     garage.AddParkingLots(numberOfParkingLots);
 }
コード例 #3
0
 private static void CreateAndParkANewCarInTheGarage(Garage garage)
 {
     var newCar = CreateANewCar();
     garage.ParkCar(newCar);
 }