Esempio n. 1
0
        /// <summary>
        /// Sets the unique properties of the subclasses of vehicle
        /// (Airplane, Boat, Bus, Car and Motorcycle)
        /// </summary>
        private static void SetUniqueProps()
        {
            if (vehicleType == "Airplane")
            {
                bool correctPassengers = false;
                int  numberOfPassengers;
                do
                {
                    ui.Print($"Input how many passengers the {vehicleType} has:");
                    bool intOK = Int32.TryParse(ui.GetInput(), out numberOfPassengers);

                    if (numberOfPassengers < 0 || !intOK)
                    {
                        PrintIncorrectInputWarning("number of passengers");
                    }
                    else
                    {
                        correctPassengers = true;
                    }
                } while (!correctPassengers);

                Airplane airplane = new Airplane(weight, registrationNumber, colour, numberOfWheels, numberOfPassengers);
                try
                { garageHandler.TryToPark(airplane, true); }
                catch (NullReferenceException ex)
                { PrintIncorrectInputWarning($"{ex.Message}"); }
            }
            else if (vehicleType == "Boat")
            {
                bool   correctLength = false;
                double length;

                do
                {
                    ui.Print($"Input the length of the {vehicleType}:");
                    bool doubleOK = Double.TryParse(ui.GetInput(), out length);

                    if (length < 0 || !doubleOK)
                    {
                        PrintIncorrectInputWarning("length");
                    }
                    else
                    {
                        correctLength = true;
                    }
                } while (!correctLength);

                Boat boat = new Boat(weight, registrationNumber, colour, numberOfWheels, length);
                garageHandler.TryToPark(boat, true);
            }
            else if (vehicleType == "Bus")
            {
                bool correctSeats = false;
                int  numberOfSeats;

                do
                {
                    ui.Print($"Input the number of seats the {vehicleType} has:");
                    bool intOK = Int32.TryParse(ui.GetInput(), out numberOfSeats);

                    if (numberOfSeats < 0 || !intOK)
                    {
                        PrintIncorrectInputWarning("number of seats");
                    }
                    else
                    {
                        correctSeats = true;
                    }
                } while (!correctSeats);

                Bus bus = new Bus(weight, registrationNumber, colour, numberOfWheels, numberOfSeats);
                garageHandler.TryToPark(bus, true);
            }
            else if (vehicleType == "Car")
            {
                bool correctDoors = false;
                int  numberOfDoors;

                do
                {
                    ui.Print($"Input the number of doors the {vehicleType} has:");
                    bool intOK = Int32.TryParse(ui.GetInput(), out numberOfDoors);

                    if (numberOfDoors < 0 || !intOK)
                    {
                        PrintIncorrectInputWarning("number of doors");
                    }
                    else
                    {
                        correctDoors = true;
                    }
                } while (!correctDoors);

                Car car = new Car(weight, registrationNumber, colour, numberOfWheels, numberOfDoors);
                garageHandler.TryToPark(car, true);
            }
            else if (vehicleType == "Motorcycle")
            {
                bool correctVolume = false;
                int  engineVolume;

                do
                {
                    ui.Print($"Input the engine volumeof the {vehicleType}:");
                    bool intOK = Int32.TryParse(ui.GetInput(), out engineVolume);

                    if (engineVolume < 0 || !intOK)
                    {
                        PrintIncorrectInputWarning("engine volume");
                    }
                    else
                    {
                        correctVolume = true;
                    }
                } while (!correctVolume);

                Motorcycle motorcycle = new Motorcycle(weight, registrationNumber, colour, numberOfWheels, engineVolume);
                garageHandler.TryToPark(motorcycle, true);
            }
        }
Esempio n. 2
0
        public void AddVehicle()
        {
            string brand;
            string fueltype;
            int    numberOfSeats;
            int    numberOfEngines;
            double cylinderVolume;
            double length;


            Console.Clear();

            if (garage.Count() <= garage.Capacity)
            {
                if (garage.Count() > 0)
                {
                    Menu1();

                    Console.WriteLine("\n Would you like to enter a new vehicle into the garage?");
                    Console.Write("\n If \"YES\", press [Enter].\n If \"NO\", press any other key:\n");
                    Console.Write(" > ");

                    PressKey();
                }
                else if (garage.Count() == 0)
                {
                    Console.Clear();
                    GarageDesign();
                }

                if (run == true)
                {
                    if (garage.Count() > 0)
                    {
                        Menu1();
                    }
                    else
                    {
                        Console.Clear();
                        GarageDesign();
                    }


                    Console.WriteLine("\n Select the type of vehicle you want to park in the garage\n");
                    Console.WriteLine(" Press:");

                    Console.WriteLine("        \"1\" - Car");
                    Console.WriteLine("        \"2\" - Airplane");
                    Console.WriteLine("        \"3\" - Bus");
                    Console.WriteLine("        \"4\" - Motorcycle");
                    Console.WriteLine("        \"5\" - Boat");

                    Console.Write("        >");
                    ConsoleKeyInfo vehicleType = Console.ReadKey();


                    switch (vehicleType.Key)
                    {
                    case ConsoleKey.D1:     // CAR
                    {
                        Console.WriteLine("\n\n You selected: Car");

                        Console.WriteLine("\n Type the brand, color, fueltype, number of wheels, weight and registernumber: ");
                        Console.Write("\n Brand: ");
                        brand = IfLetters();        //Console.ReadLine();

                        Console.Write("\n Fueltype: ");
                        fueltype = IfLetters();        //Console.ReadLine();

                        AddComponents();

                        Car car = new Car("Car", brand, fueltype, Reg_Number, color, numberOfWheels, weight);

                        garage.Park(car);

                        break;
                    }

                    case ConsoleKey.D2:     // Airplane
                    {
                        Console.WriteLine("\n\n You selected: Airplane");

                        Console.WriteLine("\n Type the number of seats, color, number of wheels, weight and registernumber: ");
                        Console.Write("\n Number of seats: ");
                        numberOfSeats = IfNum();        //Convert.ToInt32(Console.ReadLine());

                        AddComponents();

                        Airplane airplane = new Airplane("Airplane", numberOfSeats, Reg_Number, color, numberOfWheels, weight);

                        garage.Park(airplane);

                        break;
                    }

                    case ConsoleKey.D3:     // Bus
                    {
                        Console.WriteLine("\n\n You selected: Bus");

                        Console.WriteLine("\n Type the number of engines, color, number of wheels, weight and registernumber: ");
                        Console.Write("\n Number of engines: ");
                        numberOfEngines = IfNum();        //Convert.ToInt32(Console.ReadLine());

                        AddComponents();

                        Bus bus = new Bus("Bus", numberOfEngines, Reg_Number, color, numberOfWheels, weight);

                        garage.Park(bus);


                        break;
                    }

                    case ConsoleKey.D4:     // Motorcycle
                    {
                        Console.WriteLine("\n\n You selected: Motorcycle");

                        Console.WriteLine("\n Type the cylindervolume, color, number of wheels, weight and registernumber: ");
                        Console.Write("\n Cylindervolume: ");
                        cylinderVolume = IfNum();        //Convert.ToDouble(Console.ReadLine());

                        AddComponents();

                        Motorcycle motorcycle = new Motorcycle("Motorcycle", cylinderVolume, Reg_Number, color, numberOfWheels, weight);

                        garage.Park(motorcycle);

                        break;
                    }

                    case ConsoleKey.D5:     // Boat
                    {
                        Console.WriteLine("\n\n You selected: Boat");

                        Console.WriteLine("\n Type the length, color, number of wheels, weight and registernumber: ");
                        Console.Write("\n Length: ");
                        length = IfNum();        //Convert.ToDouble(Console.ReadLine());

                        AddComponents();

                        Boat boat = new Boat("Boat", length, Reg_Number, color, numberOfWheels, weight);

                        garage.Park(boat);

                        break;
                    }

                    default:
                    {
                        Console.WriteLine(" The vehicle type that you have specified does not exist. Try again:");
                        break;
                    }
                    }
                }
            }

            else
            {
                Console.Clear();

                if (garage.Count() > 0)
                {
                    Menu1();
                }
                else
                {
                    GarageDesign();
                }


                Console.WriteLine("\n Garage is full.");
            }
        }
Esempio n. 3
0
        public void ParkOrUnpark()
        {
            Console.Clear();

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine("USE + TO ADD AND\n" +
                                  "USE - TO REMOVE\n" +
                                  "USE 0 TO EXIT TO MAIN MENU\n"
                                  );
                Console.ForegroundColor = ConsoleColor.White;

                string switchinput01 = Console.ReadLine();
                Console.Clear();
                switch (switchinput01)
                {
                case "+":    // mother case
                    Console.WriteLine("TYPE 1 TO ADD CAR\n" +
                                      "TYPE 2 TO ADD BUS\n" +
                                      "TYPE 3 TO ADD MOTORCYCLE\n" +
                                      "TYPE 4 TO ADD BOAT\n" +
                                      "TYPE 5 TO ADD AIRPLANE\n" +
                                      "TYPE 0 TO EXIT TO MAIN MENU\n"
                                      /*"TYPE 9 TO CLEAN THE WINDOW*/);
                    string input = Console.ReadLine();
                    //  Console.WriteLine("YOU CHOOSE {0}\n ", input);

                    if (MaxCapDesired <= 0)
                    {
                        Console.Clear();
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine("------------------------------------------------" +
                                          "\nNO GARAGE  EXISTs. PLEASE CREATE A GARAGE FIRST \n" +
                                          "------------------------------------------------");
                        Console.ForegroundColor = ConsoleColor.White;
                    }
                    else
                    {
                        //  Garage<Vehicles> newGarage = new Garage<Vehicles>(MaxCapDesired);
                        switch (input)
                        {
                        case "1":         //child case of "+" case
                            Console.WriteLine("YOU ARE WORKING WITH 1 CAR\n");
                            Car newcar = new Car();
                            newcar.VehTYPE = "CAR";
CarRegNo:
                            Console.WriteLine("WHAT IS THE REG.NO OF THE VEHICLE?");
                            var myCarname = Console.ReadLine();
                            if (String.IsNullOrEmpty(myCarname))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("REG. NO. CANNOT BE EMPTY, PLEASE ENTER A REG. NO.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto CarRegNo;
                            }
                            else
                            {
                                newcar.Name = myCarname;
                            }
                            Console.WriteLine("WHAT IS THE TYPE OF FUEL USED?");
                            var myCarFuel = Console.ReadLine();
                            newcar.FuelType = myCarFuel;
CarEng:
                            Console.WriteLine("HOW MANY ENGINES DOES THIS VEHICLE HAS?");
                            string SmyCarEng = Console.ReadLine();
                            int    iMycareng;
                            if (!int.TryParse(SmyCarEng, out iMycareng))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC.PLEASE REENTER THE DETAILS.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto CarEng;
                            }
                            else
                            {
                                newcar.NoOfEngines = iMycareng;
                            }

CarSeat:
                            Console.WriteLine("HOW MANY SEATS DOES THIS VEHICLE HAS?");
                            string myCarseats = Console.ReadLine();
                            int    imyCarSeats;
                            if (!int.TryParse(myCarseats, out imyCarSeats))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF SEATS MUST BE NUMERIC, PLEASE REENTER THE DETAILS.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto CarSeat;
                            }
                            else
                            {
                                newcar.NoOfSeats = imyCarSeats;
                                allCapacity.AddtoList(newcar);
                            }

                            break;

                        //
                        case "2":        //child case of "+" case
                            Console.WriteLine("YOU HAVE CHOOSEN BUS\n");
                            Bus newBus = new Bus();
                            newBus.VehTYPE = "BUS";
BusRegno:
                            Console.WriteLine("WHAT IS THE REG.NO OF THE VEHICLE?");
                            string myBusname = Console.ReadLine();
                            if (String.IsNullOrEmpty(myBusname))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("REG. NO. CANNOT BE EMPTY, PLEASE ENTER A REG. NO.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto BusRegno;
                            }
                            else
                            {
                                newBus.Name = myBusname;
                            }
                            Console.WriteLine("WHAT IS THE TYPE OF FUEL USED?");
                            var myBusFuel = Console.ReadLine();
                            newBus.FuelType = myBusFuel;

MyBUSengine:
                            Console.WriteLine("HOW MANY ENGINES DOES THIS VEHICLE HAS?");
                            string myBusEng = Console.ReadLine();
                            int    iMyBusEng;
                            if (!int.TryParse(myBusEng, out iMyBusEng))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto MyBUSengine;
                            }
                            else
                            {
                                newBus.NoOfEngines = iMyBusEng;
                            }

myBUSSEATNO:
                            Console.WriteLine("HOW MANY SEATS DOES THIS VEHICLE HAS?");
                            string myBusseats = Console.ReadLine();
                            int    imybusseats;
                            if (!int.TryParse(myBusseats, out imybusseats))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto myBUSSEATNO;
                            }
                            else
                            {
                                newBus.NoOfSeats = imybusseats;
                                allCapacity.AddtoList(newBus);
                            }
                            break;

                        //
                        case "3":        //child case of "+" case
                            Console.WriteLine("YOU ARE WORKING WITH 3 MOTORCYCLE\n");
                            Motorcycle newMotorcycle = new Motorcycle();
                            newMotorcycle.VehTYPE = "MOTORCYCLE";
mcregno:
                            Console.WriteLine("WHAT IS THE REG.NO OF THE VEHICLE?");
                            var myMotorcyclename = Console.ReadLine();
                            if (String.IsNullOrEmpty(myMotorcyclename))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("REG. NO. CANNOT BE EMPTY, PLEASE ENTER A REG. NO.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto mcregno;
                            }
                            newMotorcycle.Name = myMotorcyclename;
                            Console.WriteLine("WHAT IS THE TYPE OF FUEL USED?");
                            var myMotorcycleFuel = Console.ReadLine();
                            newMotorcycle.FuelType = myMotorcycleFuel;

myMCengno:
                            Console.WriteLine("HOW MANY ENGINES DOES THIS VEHICLE HAS?");
                            string myMotorcycleEng = Console.ReadLine();
                            int    iMymotorcycleeng;
                            if (!int.TryParse(myMotorcycleEng, out iMymotorcycleeng))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto myMCengno;
                            }
                            else
                            {
                                newMotorcycle.NoOfEngines = iMymotorcycleeng;
                            }

myMCSeatno:
                            Console.WriteLine("HOW MANY SEATS DOES THIS VEHICLE HAS?");
                            string myMotorcycleseats = Console.ReadLine();
                            int    imyMotorcycleseats;
                            if (!int.TryParse(myMotorcycleseats, out imyMotorcycleseats))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF SEATS MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto myMCSeatno;
                            }
                            else
                            {
                                newMotorcycle.NoOfSeats = imyMotorcycleseats;
                                allCapacity.AddtoList(newMotorcycle);
                            }
                            break;

                        //
                        case "4":        //child case of "+" case
                            Console.WriteLine("YOU ARE WORKING WITH 4 BOAT\n");
                            Boat newBoat = new Boat();
                            newBoat.VehTYPE = "BOAT";
newBoatReg:
                            Console.WriteLine("WHAT IS THE REG.NO OF THE VEHICLE?");
                            var myBoatname = Console.ReadLine();
                            if (String.IsNullOrEmpty(myBoatname))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("REG. NO. CANNOT BE EMPTY, PLEASE ENTER A REG. NO.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto newBoatReg;
                            }
                            newBoat.Name = myBoatname;
                            Console.WriteLine("WHAT IS THE TYPE OF FUEL USED?");
                            var myBoatFuel = Console.ReadLine();
                            newBoat.FuelType = myBoatFuel;

mynewBoat:
                            Console.WriteLine("HOW MANY ENGINES DOES THIS VEHICLE HAS? ");
                            string myBoatEng = Console.ReadLine();
                            int    iMynewboat;
                            if (!int.TryParse(myBoatEng, out iMynewboat))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto mynewBoat;
                            }
                            else
                            {
                                newBoat.NoOfEngines = iMynewboat;
                            }
mynewboatseats:
                            Console.WriteLine("HOW MANY SEATS DOES THIS VEHICLE HAS?");
                            string myBoatseats = Console.ReadLine();
                            int    imyBoatseats;
                            if (!int.TryParse(myBoatseats, out imyBoatseats))

                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF SEATS MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto mynewboatseats;
                            }
                            else
                            {
                                newBoat.NoOfSeats = imyBoatseats;
                                allCapacity.AddtoList(newBoat);
                            }
                            break;

                        case "5":        //child case of "+" case
                            Console.Write("YOU ARE WORKING WITH 5 AIRPLANE\n");
                            Airplane newAirplane = new Airplane();
                            newAirplane.VehTYPE = "AIRPLANE";
newAPregno:
                            Console.Write("WHAT IS THE REG.NO OF THE VEHICLE?");
                            var myAirplanename = Console.ReadLine();
                            if (string.IsNullOrEmpty(myAirplanename))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("REG. NO. CANNOT BE EMPTY, PLEASE ENTER A REG. NO.");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto newAPregno;
                            }
                            newAirplane.Name = myAirplanename;
                            Console.Write("WHAT IS THE TYPE OF FUEL USED?");
                            var myAirplaneFuel = Console.ReadLine();
                            newAirplane.FuelType = myAirplaneFuel;

APengno:
                            Console.Write("HOW MANY ENGINES DOES THIS VEHICLE HAS?");
                            string myAirplaneEng = Console.ReadLine();
                            int    iMyAPeng;
                            if (!int.TryParse(myAirplaneEng, out iMyAPeng))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF ENGINE MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto APengno;
                            }
                            else
                            {
                                newAirplane.NoOfEngines = iMyAPeng;
                            }

myApSeats:
                            Console.Write("HOW MANY SEATS DOES THIS VEHICLE HAS?");
                            string myAirplaneseats = Console.ReadLine();
                            int    imyapseats;
                            if (!int.TryParse(myAirplaneseats, out imyapseats))
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Console.WriteLine("NO. OF SEATS MUST BE NUMERIC, PLEASE REENTER THE DETAILS");
                                Console.ReadLine();
                                Console.ForegroundColor = ConsoleColor.White;
                                goto myApSeats;
                            }
                            else
                            {
                                newAirplane.NoOfSeats = imyapseats;
                                allCapacity.AddtoList(newAirplane);
                            }
                            break;

                        //
                        case "0":        //child case of "+" case
                            Console.WriteLine("RETURN ONE STEP BACK\n");
                            return;

                        //
                        case "9":
                            Console.WriteLine("CLEAN THE WINDOW");
                            Console.Clear();
                            break;

                        //
                        default:        //child case of "+" case
                            Console.WriteLine("INVALID INPUT! ENTER SOMETHING FROM OPTIONS\n");
                            break;
                            //
                        }
                    }
                    break;    // this is for +

                    #endregion SWITCH CASE FOR ADDING VEHICLES END HERE
                    #region SWITCH CASE FOR REMOVING VEHICLES
                case "-":
                    Console.WriteLine("TYPE 1 TO REMOVE CAR\n" +
                                      "TYPE 2 TO REMOVE BUS\n" +
                                      "TYPE 3 TO REMOVE MOTORCYCLE\n" +
                                      "TYPE 4 TO REMOVE BOAT\n" +
                                      "TYPE 5 TO REMOVE AIRPLANE\n" +
                                      "TYPE 0 TO EXIT TO MAIN MENU\n"
                                      /*"TYPE 9 TO CLEAN THE WINDOW*/);
                    string input1 = Console.ReadLine();
                    switch (input1)
                    {
                    case "1":
                        Console.WriteLine("GIVE THE REG.NO. OF THE CAR YOU WANT TO UNPARK!!!\n");
                        Car rnewCar = new Car();
                        Console.Write("WHAT IS THE REG. NO OF YOUR CAR ?");
                        var rmyCarname = Console.ReadLine();
                        rnewCar.Name = rmyCarname;
                        if (allCapacity != null)
                        {
                            allCapacity.RemoveVeh(rnewCar);
                        }
                        else
                        {
                            Console.WriteLine("\n++++++++++++++++++++++++++++++++++++++++\nNo CAR with this REG. No in the garage\n++++++++++++++++++++++++++++++++++++++++");
                        }
                        break;

                    case "2":
                        Bus rnewBus = new Bus();
                        Console.Write("WHAT IS THE REG. NO. OF YOUR BUS ?");
                        var rmyBusname = Console.ReadLine();
                        rnewBus.Name = rmyBusname;
                        if (rnewBus.Name == rmyBusname)
                        {
                            allCapacity.RemoveVeh(rnewBus);
                        }
                        else
                        {
                            Console.WriteLine("\n++++++++++++++++++++++++++++++++++++++++\nNo BUS with this REG. No in the garage\n++++++++++++++++++++++++++++++++++++++++");
                        }
                        break;

                    case "3":
                        Motorcycle rnewMC = new Motorcycle();
                        Console.Write("WHAT IS THE REG. NO OF YOUR MOTORCYCLE ?");
                        var rnewMC1 = Console.ReadLine();
                        rnewMC.Name = rnewMC1;

                        if (rnewMC.Name == rnewMC1)
                        {
                            allCapacity.RemoveVeh(rnewMC);
                        }
                        else
                        {
                            Console.WriteLine("\n++++++++++++++++++++++++++++++++++++++++\nNo MOTORCYCLE with this REG. No in the garage\n++++++++++++++++++++++++++++++++++++++++");
                        }
                        break;

                    case "4":
                        Boat rnewBoat = new Boat();
                        Console.Write("WHAT IS THE REG. NO. OF YOUR BOAT ?");
                        var rnewBoat1 = Console.ReadLine();
                        rnewBoat.Name = rnewBoat1;
                        if (rnewBoat.Name == rnewBoat1)
                        {
                            allCapacity.RemoveVeh(rnewBoat);
                        }
                        else
                        {
                            Console.WriteLine("\n++++++++++++++++++++++++++++++++++++++++\nNo MOTORCYCLE with this REG. No in the garage\n++++++++++++++++++++++++++++++++++++++++");
                        }
                        break;

                    case "5":
                        Airplane rnewAP = new Airplane();
                        Console.Write("WHAT IS THE REG. NO. OF YOUR AIRPLANE ?");
                        var rnewAP1 = Console.ReadLine();
                        rnewAP.Name = rnewAP1;
                        if (rnewAP.Name == rnewAP1)
                        {
                            allCapacity.RemoveVeh(rnewAP);
                        }
                        else
                        {
                            Console.WriteLine("\n++++++++++++++++++++++++++++++++++++++++\nNo MOTORCYCLE with this REG. No in the garage\n++++++++++++++++++++++++++++++++++++++++");
                        }
                        break;
                    }
                    break;

                case "0":
                    return;
                }
            }
        }