Ejemplo n.º 1
0
        internal void SetAttribute(string i_WhichAttributeToSet, string i_InputFromUser)
        {
            int color, numOfDoors;

            if (i_WhichAttributeToSet == "Color")
            {
                color = int.Parse(i_InputFromUser);
                if (color > 4 || color < 0)
                {
                    throw new ValueOutOfRangeException(0, 3);
                }

                m_Color = (eCarColor)color;
            }

            if (i_WhichAttributeToSet == "NumOfDoors")
            {
                numOfDoors = int.Parse(i_InputFromUser);
                if (numOfDoors > 5 || numOfDoors < 2)
                {
                    throw new ValueOutOfRangeException(2, 5);
                }

                m_NumOfDoors = (eNumbersOfDoors)numOfDoors;
            }
        }
Ejemplo n.º 2
0
 public Car(eColor i_CarColor, eNumbersOfDoors i_NumberOfDoors, string i_ModelName, string i_LicensePlateNumber, eMaximumAirPressure i_MaximumAirPressureForVehicle, List <Wheel> i_CarWheels, Engine i_CarEngine) : base(i_ModelName, i_LicensePlateNumber, i_MaximumAirPressureForVehicle, i_CarWheels, i_CarEngine)
 {
     r_Color         = i_CarColor;
     r_NumberOfDoors = i_NumberOfDoors;
 }