Ejemplo n.º 1
0
 public Car(eCarColors i_ChosenColor, eNumberOfDoors i_CarDoors, EnergyType o_TypeOfEnergy, string o_ModelName, string o_LicensePlate, OwnerDetails o_CarOwner, List <Wheel> o_Wheels)
     : base(o_ModelName, o_LicensePlate, o_CarOwner, o_Wheels)
 {
     m_CarColor      = i_ChosenColor;
     m_NumberOfDoors = i_CarDoors;
     m_EnergyType    = o_TypeOfEnergy;
     EnergyRatio     = o_TypeOfEnergy.CalculateRatio();
 }
Ejemplo n.º 2
0
        private static Car createCar(ArgumentsCollection i_Arguments, Motor i_Motor)
        {
            string            licensePlate  = (string)i_Arguments[eArgumentKeys.LicensePlate].Response;
            string            model         = (string)i_Arguments[eArgumentKeys.Model].Response;
            eNumberOfCarDoors numberOfDoors = (eNumberOfCarDoors)Enum.Parse(typeof(eNumberOfCarDoors), i_Arguments[eArgumentKeys.NumberOfDoors].Response);
            eCarColors        carColor      = (eCarColors)Enum.Parse(typeof(eCarColors), i_Arguments[eArgumentKeys.Color].Response);

            Wheel[] wheels = wheelsCollectionBuilder(i_Arguments, Car.k_NumberOfWheels, VehicleMaxConstantsCollection[eVehicleMaxConstantTypes.CarMaxWheelPressure]);
            return(new Car(i_Motor, wheels, VehicleMaxConstantsCollection[eVehicleMaxConstantTypes.CarMaxWheelPressure], licensePlate, model, carColor, numberOfDoors));
        }
Ejemplo n.º 3
0
        public void TrySetCarColor(string inputtedColor)
        {
            int  selectedColor;
            bool validSelectedColor = int.TryParse(inputtedColor, out selectedColor);

            if (!validSelectedColor)
            {
                throw new FormatException("CarColor");
            }
            else if (selectedColor < 1 || selectedColor > 4)
            {
                throw new ValueOutOfRangeException("CarColorSelection", 1, 4);
            }

            m_CarColor = (eCarColors)selectedColor;
        }
Ejemplo n.º 4
0
 public Car(
     VehicleFactory.eVehicleType i_VehicleType,
     string i_ModelName,
     string i_LicenseNumber,
     Tire[] i_Tires,
     Engine i_Engine,
     float i_EnergyPercentageLeft,
     string i_TireManufactureName,
     float i_TireCurrentAirPressure,
     eCarColors i_CarColor,
     eNumberOfDoors i_NumOfDoors)
     : base(i_VehicleType, i_ModelName, i_LicenseNumber, i_Tires, i_Engine, i_EnergyPercentageLeft, i_TireManufactureName, k_MaxAirPressure, i_TireCurrentAirPressure)
 {
     r_CarColor   = i_CarColor;
     r_NumOfDoors = i_NumOfDoors;
 }
Ejemplo n.º 5
0
        public static Dictionary <eVehicleInfoParams, ParameterValidator> BuildExtraParameters()
        {
            StringBuilder strToPrint = new StringBuilder();
            eCarColors    carColor   = eCarColors.BLACK;
            eCarDoors     carDoors   = eCarDoors.FIVE;
            Dictionary <eVehicleInfoParams, ParameterValidator> keyValues = new Dictionary <eVehicleInfoParams, ParameterValidator>();

            strToPrint.AppendLine("Please enter your car color: ");
            strToPrint.Append(StringUtils.GetEnumListAsString(carColor));
            keyValues.Add(eVehicleInfoParams.carColor, new ParameterValidator(strToPrint.ToString(), ParameterValidator.eValidityTypes.CarColor));
            strToPrint.Clear();
            strToPrint.AppendLine("Please enter your number of doors: ");
            strToPrint.Append(StringUtils.GetEnumListAsString(carDoors));
            keyValues.Add(eVehicleInfoParams.carDoors, new ParameterValidator(strToPrint.ToString(), ParameterValidator.eValidityTypes.DoorNumber));

            return(keyValues);
        }
Ejemplo n.º 6
0
        public static void CheckInputParameterValid(string i_InputString, eValidityTypes i_ValidityType)
        {
            eCarDoors    carDoors    = eCarDoors.FIVE;
            eCarColors   carColors   = eCarColors.BLACK;
            eLicenseType licenseType = eLicenseType.A;

            switch (i_ValidityType)
            {
            case eValidityTypes.All:
                break;

            case eValidityTypes.LettersOnly:
                StringUtils.CheckStringConsistsOnlyLetters(i_InputString);
                break;

            case eValidityTypes.NumberOnly:
                StringUtils.CheckStringConsistsOnlyNumbers(i_InputString);
                break;

            case eValidityTypes.Boolean:
                StringUtils.CheckStringRepresentBool(i_InputString);
                break;

            case eValidityTypes.CarColor:
                checkEnumChoiceIsValid(i_InputString, carColors);
                break;

            case eValidityTypes.DoorNumber:
                checkEnumChoiceIsValid(i_InputString, carDoors);
                break;

            case eValidityTypes.LicenseType:
                checkEnumChoiceIsValid(i_InputString, licenseType);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(i_ValidityType), i_ValidityType, null);
            }
        }
Ejemplo n.º 7
0
        private static Vehicle createCar(Engine i_Engine, Dictionary <eVehicleInfoParams, string> i_VehicleParameters)
        {
            string modelName;
            string licenseNumber;
            float  energyPercentageLeft;
            string wheelManufactureName;
            float  wheelCurrentAirPressure;

            eCarColors carColor = (eCarColors)Enum.Parse(typeof(eCarColors), i_VehicleParameters[eVehicleInfoParams.carColor]);
            eCarDoors  carDoors = (eCarDoors)Enum.Parse(typeof(eCarDoors), i_VehicleParameters[eVehicleInfoParams.carDoors]);

            getVehicleParameters(
                i_VehicleParameters,
                out modelName,
                out licenseNumber,
                out energyPercentageLeft,
                out wheelManufactureName,
                out wheelCurrentAirPressure);

            Car car = new Car(carColor, carDoors, modelName, licenseNumber, energyPercentageLeft, new Wheel[Car.k_NumOfWheels], i_Engine, wheelManufactureName, wheelCurrentAirPressure, Car.k_MaxAirPressure);

            return(car);
        }
Ejemplo n.º 8
0
        public static ElectricCar CreateElectricCar(string i_VehicleModel, string i_LicencePlate, float i_BatteryLeft, eCarColors i_Color, eNumOfDoors i_NumOfDoors,
                                                    string i_WheelMaker, float i_WheelCurrentPressure, VehicleOwner i_Owner)
        {
            ElectricCar electricCar = new ElectricCar(i_VehicleModel, i_LicencePlate, i_BatteryLeft, k_CarMaxBattery, i_Color, k_CarNumOfWheels, i_NumOfDoors, i_Owner);

            GenerateWheels(electricCar, k_CarMaxWheelPressure, i_WheelMaker, i_WheelCurrentPressure);

            return(electricCar);
        }
Ejemplo n.º 9
0
        public static Car CreateCar(string i_VehicleModel, string i_LicencePlate, float i_FuelLeft, eCarColors i_Color, eNumOfDoors i_NumOfDoors,
                                    string i_WheelMaker, float i_WheelCurrentPressure, VehicleOwner i_Owner)
        {
            Car car = new Car(i_VehicleModel, i_LicencePlate, i_FuelLeft, k_CarMaxFuel, k_CarNumOfWheels, i_Color, i_NumOfDoors, i_Owner);

            GenerateWheels(car, k_CarMaxWheelPressure, i_WheelMaker, i_WheelCurrentPressure);

            return(car);
        }
Ejemplo n.º 10
0
 public Car(eCarColors i_CarsColor, eCarDoors i_AmountOfDoors, string i_ModelName, string i_LicensingNumber, float i_LeftEnergy, Wheel[] i_Wheels, Engine i_Engine, string i_ManufacturerName, float i_CurrAirPressure, float i_MaxAirPressure)
     : base(i_ModelName, i_LicensingNumber, i_LeftEnergy, i_Wheels, i_Engine, i_ManufacturerName, i_CurrAirPressure, i_MaxAirPressure)
 {
     m_CarColor      = i_CarsColor;
     m_AmountOfDoors = i_AmountOfDoors;
 }
Ejemplo n.º 11
0
 public ElectricCar(eCarColors i_CarColor, eCarDoorsAmount i_CarDoors)
     : base(i_CarColor, i_CarDoors)
 {
 }
Ejemplo n.º 12
0
 public Car(eCarColors i_CarColor, eCarDoorsAmount i_CarDoors)
 {
     m_CarColor = i_CarColor;
     m_CarDoors = i_CarDoors;
 }
Ejemplo n.º 13
0
 public Car(string i_VehicleModel, string i_LicencePlate, float i_FuelLeft, float i_MaxFuel, byte i_NumOfWheels, eCarColors i_Color, eNumOfDoors i_NumOfDoors, VehicleOwner i_Owner) :
     base(i_VehicleModel, i_LicencePlate, i_FuelLeft, i_MaxFuel, i_NumOfWheels, eFuelTypes.Octan96, i_Owner)
 {
     m_Color      = i_Color;
     m_NumOfDoors = i_NumOfDoors;
 }
Ejemplo n.º 14
0
 public ElectricCar(string i_VehicleModel, string i_LicencePlate, float i_EnergyLeft, float i_MaxBattery, eCarColors i_Color, byte i_NumOfWheels, eNumOfDoors i_NumOfDoors, VehicleOwner i_Owner) :
     base(i_VehicleModel, i_LicencePlate, i_EnergyLeft, i_MaxBattery, i_NumOfWheels, i_Owner)
 {
     m_Color      = i_Color;
     m_NumOfDoors = i_NumOfDoors;
 }
Ejemplo n.º 15
0
 public GasCar(eCarColors i_CarColor, eCarDoorsAmount i_CarDoors)
     : base(i_CarColor, i_CarDoors)
 {
 }