public ElectroCar(string name, double? mileage, ElectroEngine electroEngine, double weight, string additionalInfo, Pilot pilot, int chargeLevel) : base(name, mileage, weight, additionalInfo, pilot) { if (chargeLevel < 0 || chargeLevel > 100) throw new ArgumentException("Charge lvl can't be below zero or more than 100"); ChargeLevel = chargeLevel; Engine = electroEngine; AccelerationSpeed = Engine.HorsePowers/Weight*100; }
private ElectroEngine CreateElectroEngine(int horsePower) { var engine = new ElectroEngine(horsePower); return engine; }