// private string m_wheelManufacturer; public Car(eColor i_color, eCarNumberOfDoors i_numberOfDoors, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_vehicleInformation) { m_wheelInformation = new WheelInformation(32, 4, i_wheelManufacturer); base.WheelInformation = m_wheelInformation; m_numberOfDoors = i_numberOfDoors; m_color = i_color; }
public override void SetProperty(int i_Property, string i_InputFromUser) { eCarProperties property = (eCarProperties)i_Property; int inputFromUserInt; switch (property) { case eCarProperties.Model: Model = i_InputFromUser; break; case eCarProperties.Color: if (int.TryParse(i_InputFromUser, out inputFromUserInt)) { if (Enum.IsDefined(typeof(eCarColor), inputFromUserInt)) { CarColor = (eCarColor)inputFromUserInt; } else { throw new ValueOutOfRangeException(1, Enum.GetNames(typeof(eCarColor)).Length, "You have entered out of range input!"); } } else { throw new FormatException("You have entered wrong input!"); } break; case eCarProperties.NumberOfDoors: if (int.TryParse(i_InputFromUser, out inputFromUserInt)) { if (Enum.IsDefined(typeof(eCarNumberOfDoors), inputFromUserInt)) { NumberOfDoors = (eCarNumberOfDoors)inputFromUserInt; } else { throw new ValueOutOfRangeException(1, Enum.GetNames(typeof(eCarNumberOfDoors)).Length, "You have entered out of range input!"); } } else { throw new FormatException("You have entered wrong input!"); } break; } }
public void SetCarNumOfDoors(string i_NumOfDoors) { try { int parsedNumOfDoors = int.Parse(i_NumOfDoors); CarNumOfDoors = (eCarNumberOfDoors)parsedNumOfDoors; } catch (FormatException) { throw; } catch (ArgumentException) { throw; } }
internal override void SetProperties(List <object> i_OtherProperties) { m_Properties = i_OtherProperties; m_CarColour = (eCarColour)i_OtherProperties.ElementAt(0); m_CarNumberOfDoors = (eCarNumberOfDoors)i_OtherProperties.ElementAt(1); }
public ElectricCar(eColor i_color, eCarNumberOfDoors i_numberOfDoors, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_color, i_numberOfDoors, i_vehicleInformation, i_wheelManufacturer) { m_ElectricEngine = new ElectricEngine(m_maxBatteryHours, 0); //i_vehicleInformation.VehicleType = VehicleInformation.eVehicleType.ElectricCar; }
public FuelBasedCar(eColor i_color, eCarNumberOfDoors i_numberOfDoors, VehicleInformation i_vehicleInformation, string i_wheelManufacturer) : base(i_color, i_numberOfDoors, i_vehicleInformation, i_wheelManufacturer) { m_FuelEngine = new FuelEngine(m_MaxFuelAmountLiters, 0, FuelEngine.eFuelType.Octane98); // i_vehicleInformation.VehicleType = VehicleInformation.eVehicleType.FuelBasedCar; }