public void Execute() { SelectCarType(); Brand brand = SelectBrand(); SelectColour(); IColourDecoration colourDecoration = SelectColourDeco(); EngineClass engine = SelectEngine(); SelectWheel(); IWheelDeco wheelDeco = SelectWheelDeco(); Numberplate numberplate = AssignNumberplate(); IWheel wheel = (IWheel)Activator.CreateInstance(wheelList[listOfIndex.Last()], wheelDeco); listOfIndex.RemoveAt(listOfIndex.Count - 1); ICarColour carColour = (ICarColour)Activator.CreateInstance(carColourList[listOfIndex.Last()], colourDecoration); listOfIndex.RemoveAt(listOfIndex.Count - 1); Vehicle vehicle = (Vehicle)Activator.CreateInstance(types[listOfIndex.Last()], new object[] { carColour, wheel, brand, numberplate, engine }); Console.WriteLine("Congratulation you successfully added a new vehicle"); carDealer.AddVehicleToList(vehicle); command = new PrintVehicleCommand() { List = carDealer.Vehicles }; command.Execute(); listOfIndex.Clear(); }
private Numberplate AssignNumberplate() { Console.WriteLine("Please enter your Numberplate: "); input = Console.ReadLine(); Numberplate numberplate = new Numberplate(input); return(numberplate); }
protected Vehicle(ICarColour carColour, IWheel wheel, Brand brand, Numberplate numberplate, EngineClass engine) { this.brand = brand; this.carColour = carColour; this.numberplate = numberplate; this.wheel = wheel; this.engine = engine; id = ++counter; price = wheel.Price() + carColour.CalculatePrice() + brand.GetPrice() + engine.GetPrice(); }
public Truck(ICarColour carColour, IWheel wheel, Brand brand, Numberplate numberplate, EngineClass engine) : base(carColour, wheel, brand, numberplate, engine) { }
public Vehicle CreateVehicle(CarColour carColour, IWheel wheel, Brand brand, Numberplate numberplate, EngineClass engine) { return(new Car(carColour, wheel, brand, numberplate, engine)); }
public Vehicle CreateVWVehicle(string name, CarColour carColour, IWheel wheel, Numberplate numberplate, EngineClass engine) { this.brand = new VW(name); return(new Car(carColour, wheel, brand, numberplate, engine)); }