private static void ShowProduct(IHyperion finishProduct, int productNumber) { var hasPowerWindows = ""; System.Console.WriteLine($"{finishProduct.GetType().Name} Product {productNumber} has the following specifications: "); System.Console.WriteLine($"Has {finishProduct.Wheels}-inch wheels."); System.Console.WriteLine($"Has {finishProduct.Doors} doors."); System.Console.WriteLine($"Has {finishProduct.Engine} liter engine capacity."); if (!finishProduct.HasPowerWindows) { hasPowerWindows = " no"; } System.Console.WriteLine($"Has{hasPowerWindows} power windows."); System.Console.WriteLine($"Has {finishProduct.Color} color."); System.Console.WriteLine("Engine has started!"); }
public IHyperion CreateInstance(List <IHyperion> hyperions) { IHyperion productInstance = null; switch (hyperions.GetType().Name) { case "Sedan": productInstance = CarFactory <IHyperion, Sedan> .CreateInstance(); break; case "Coupe": productInstance = CarFactory <IHyperion, Coupe> .CreateInstance(); break; case "Sport": productInstance = CarFactory <IHyperion, Sport> .CreateInstance(); break; } return(productInstance); }