public static void Main(string[] args) { Console.WriteLine("What Product Do you want"); string productName = Console.ReadLine(); Console.WriteLine("What Brand Do you prefer of " + productName); string BrandName = Console.ReadLine(); FactoryCreator fof = new FactoryCreator(); AbstractFactory brandfactory = fof.GetFactory("Brand"); IBrand brand = brandfactory.GetBrandsInstance(BrandName); AbstractFactory productfactory = fof.GetFactory("Product"); IProduct product = productfactory.GetProductsInstance(productName, brand.GetBrandName()); product.GetProduct(); Console.ReadKey(); }
private void CheckMeal() { bool isInt = int.TryParse(Console.ReadLine(), out int mealTypeNum); if (isInt && Enum.IsDefined(typeof(MealType), mealTypeNum)) { orderMealFactory = FactoryCreator.GetFactory((MealType)mealTypeNum); Console.Clear(); ChooseBeverage(); } else { Console.Clear(); Console.WriteLine("You didn't choose correctly."); ChooseMeal(); } }