Example #1
0
        private bool ParkCar(string[] input)
        {
            if (input.Length != 6)
            {
                errorMessages.Add($"To park a car you need to specify 6 values. {input.Length} values were found.");
                return(false);
            }
            int numberOfWheels, emptyMass;
            CarPropulsionType propulsionType = (CarPropulsionType)Enum.Parse(typeof(CarPropulsionType), input[5]);

            if (!int.TryParse(input[3], out numberOfWheels) || !int.TryParse(input[4], out emptyMass))
            {
                errorMessages.Add("Please make sure to enter numbers where requested.");
                return(false);
            }
            var vehicle = new Car(input[1], input[2], numberOfWheels, emptyMass, propulsionType);

            if (garage.ParkVehicle(vehicle))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
 public Car(string registrationNumber, string color, int numberOfWheels, int emptyMass, CarPropulsionType propulsionType) : base(registrationNumber, color, numberOfWheels, emptyMass)
 {
     PropulsionType = propulsionType;
 }