Пример #1
0
        private static void Main()
        {
            CookingMethod cookMethod = new CookingMethod();

            Console.WriteLine("What food would you like to cook?");
            string food = Console.ReadLine();

            cookMethod.SetFood(food);

            Console.WriteLine("What cooking strategy would you like to use (1-3)?");
            switch (int.Parse(Console.ReadKey().KeyChar.ToString()))
            {
            case 1:
                cookMethod.SetCookStrategy(new Grilling());
                cookMethod.Cook();
                break;

            case 2:
                cookMethod.SetCookStrategy(new OvenBaking());
                cookMethod.Cook();
                break;

            case 3:
                cookMethod.SetCookStrategy(new DeepFrying());
                cookMethod.Cook();
                break;

            default:
                Console.WriteLine("Invalid Selection!");
                break;
            }
        }
Пример #2
0
        private static void Main()
        {
            var cookingMethod = new CookingMethod();

            Console.WriteLine("What food would you like to cook?");
            var food = Console.ReadLine();

            cookingMethod.FindAppropriateCookingMethod(food);
            cookingMethod.Cook();
        }