コード例 #1
0
        public bool ParkCar(Garage <Vehicle> garage, string regNumber, string color, int noOfWheel, int cylinderVolume, string fuelType, int noOfEngines)
        {
            var car = new Car(regNumber, color, noOfWheel, cylinderVolume, fuelType, noOfEngines);

            if (garage.Add(car))
            {
                Console.WriteLine($"\n{regNumber} has been parked to garage successfully.\n");
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        public bool ParkMC(Garage <Vehicle> garage, string registeringNumber, string color, int noWheel, int cylinderVolume, string fuelType)
        {
            var mc = new Motorcycle(registeringNumber, color, noWheel, cylinderVolume, fuelType);

            if (garage.Add(mc))
            {
                Console.WriteLine($"\n{registeringNumber} has been parked to garage successfully.\n");
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        public bool ParkAirplane(Garage <Vehicle> garage, string registeringNumber, string color, int noWheel, string type)
        {
            var airplane = new Airplane(registeringNumber, color, noWheel, type);

            if (garage.Add(airplane))
            {
                Console.WriteLine($"\n{registeringNumber} has been parked to garage successfully.\n");
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        public bool ParkBus(Garage <Vehicle> garage, string registeringNumber, string color, int noWheel, int cylinderVolume, string fuelType, int noOfSeats)
        {
            var bus = new Bus(registeringNumber, color, noWheel, cylinderVolume, fuelType, noOfSeats);

            if (garage.Add(bus))
            {
                Console.WriteLine($"\n{registeringNumber} has been parked to garage successfully.\n");
                return(true);
            }
            else
            {
                return(false);
            }
        }