Exemplo n.º 1
0
        public override void SetProperties(string i_Property, string i_Value)
        {
            switch (i_Property)
            {
            case "Vehicle Model":
                ModelName = i_Value;
                break;

            case "Wheels Manufacturer":
                Wheel.SetWheelsManufacturer(Wheels, WheelCount, i_Value);
                break;

            case "Wheels Current Tire Pressure":
                float currentTirePressure = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "Wheels Current Tire Pressure must be a number");
                Wheel.SetWheelsCurrentTirePressure(Wheels, WheelCount, currentTirePressure);
                break;

            case "Is Transporting Hazardous Materials?":
                m_IsTransportingHazardousMaterials = checkIsTransportingHazardousMaterials(i_Value);
                break;

            case "Payload Capacity":
                m_PayloadCapacity = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "The payload capacity must be a number.");
                break;

            case "Gas Gauge":
                float     gasGauge  = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "Gas gauge must be a number.");
                GasEngine GasEngine = Engine as GasEngine;
                GasEngine.GasGague = gasGauge;
                break;
            }
        }
Exemplo n.º 2
0
        public override void SetProperties(string i_Property, string i_Value)
        {
            switch (i_Property)
            {
            case "Vehicle Model":
                ModelName = i_Value;
                break;

            case "Wheels Manufacturer":
                Wheel.SetWheelsManufacturer(Wheels, WheelCount, i_Value);
                break;

            case "Wheels Current Tire Pressure":
                float currentTirePressure = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "Wheels Current Tire Pressure must be a number");
                Wheel.SetWheelsCurrentTirePressure(Wheels, WheelCount, currentTirePressure);
                break;

            case "Car Color":
                CarColor = CheckCarColor(i_Value);
                break;

            case "Doors Count":
                DoorCount = CheckDoorCount(i_Value);
                break;

            case "Gas Gauge":
                float     gasGauge  = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "Gas gauge must be a number.");
                GasEngine gasEngine = Engine as GasEngine;
                gasEngine.GasGague = gasGauge;
                break;

            case "Battery Charge":
                float          batteryCharge  = ParsingHelper.ParseToFloatAndThrowProvidedMessage(i_Value, "Battery charge must be a number.");
                ElectricEngine electricEngine = Engine as ElectricEngine;
                electricEngine.BatteryCharge = batteryCharge;
                break;
            }
        }