コード例 #1
0
        public static void Run()
        {
            MealBuilder mb      = new MealBuilder();
            var         vegMeal = mb.prepareVegMeal();

            vegMeal.showItems();
            Console.WriteLine($"Total: {vegMeal.getCost()}");

            var chickenMeal = mb.prepareChickenMeal();

            chickenMeal.showItems();
            Console.WriteLine($"Total: {chickenMeal.getCost()}");
        }
コード例 #2
0
        public static void Output()
        {
            var mealBuilder = new MealBuilder();

            //creating a vegetarian meal
            var vegetarianMeal = mealBuilder.PrepareVegetarianMeal();

            Trace.WriteLine("Vegetarian Meal" + Environment.NewLine);
            vegetarianMeal.ShowItems();
            Trace.WriteLine("Total Cost: " + vegetarianMeal.GetCost() + Environment.NewLine);

            //creating non vegetarian meal
            var nonVegetarianMeal = mealBuilder.PrepareNonVegetarianMeal();

            Trace.WriteLine("\n\n Non-Vegetarian Meal" + Environment.NewLine);
            nonVegetarianMeal.ShowItems();
            Trace.WriteLine("Total Cost: " + nonVegetarianMeal.GetCost() + Environment.NewLine);
        }