Beispiel #1
0
 public void MakeMeal(MealBuilder mealBuilder)
 {
     mealBuilder.AddSandwich();
     mealBuilder.AddSideOrder();
     mealBuilder.AddDrink();
     mealBuilder.AddOfferItem();
     mealBuilder.SetPrice();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            MealBuilder mealBuilder = new MealBuilder();
            var         meal        = mealBuilder.PrepareVegMeal();

            Console.WriteLine("Cost" + meal.GetCost());
            meal.ShowItems();
        }
Beispiel #3
0
        static void Main()
        {
            MealBuilder mb     = (MealBuilder)XMLUtil.getBean();
            KFCWaiter   waiter = new KFCWaiter();

            waiter.setMealBuilder(mb);
            Meal meal = waiter.construct();

            Console.WriteLine("ÌײÍ×é³É£º");
            Console.WriteLine(meal.getFood());
            Console.WriteLine(meal.getDrink());
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            MealBuilder mb = new MealBuilder();

            Console.WriteLine("Veg meal");
            Meal VegMeal = mb.prepareVegMeal();

            Console.WriteLine("Cost: ", VegMeal.getCost());
            Console.WriteLine("Non Veg meal");
            Meal m = mb.prepareNonVegMeal();

            Console.WriteLine("Cost: ", m.getCost());
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            MealBuilder mealBuilder = new MealBuilder();

            Meal vegMeal = mealBuilder.prepareVegMeal();

            Console.WriteLine("Veg Meal");
            vegMeal.showItems();
            Console.WriteLine("Total cost: " + vegMeal.getCost());

            Meal nonvegMeal = mealBuilder.prepareNonVegMeal();

            Console.WriteLine("Veg Meal");
            nonvegMeal.showItems();
            Console.WriteLine("Total cost: " + nonvegMeal.getCost());

            Console.ReadKey();
        }
Beispiel #6
0
        /// <summary>
        /// The Builder Demo
        /// Separates the construction of a complex object from its representation
        /// so that the same construction process can create different representations
        /// Great for Parsing data, building from a template and Making a burger!
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            MealBuilder mealBuilder = new MealBuilder();

            Meal vegMeal = mealBuilder.prepVeggieMeal();

            Console.WriteLine("Vegetarian Meal");
            vegMeal.showItems();
            Console.WriteLine("Total Cost: ${0}", vegMeal.getCost());

            Meal meatMeal = mealBuilder.prepMeatMeal();

            Console.WriteLine("Meaty Meal");
            meatMeal.showItems();
            Console.WriteLine("Total Cost: ${0}", meatMeal.getCost());

            Console.Read();
        }
Beispiel #7
0
        public static void Demo()
        {
            MealBuilder mealBuilder = new MealBuilder();

            Meal vegMeal = mealBuilder.VegMeal();

            Console.WriteLine("Veg Meal");
            vegMeal.ShowItems();
            Console.WriteLine("Total Cost: " + vegMeal.TotalCost());

            Meal nonVegMeal = mealBuilder.NonVegMeal();

            Console.WriteLine("\n\nNon-Veg Meal");
            nonVegMeal.ShowItems();
            Console.WriteLine("Total Cost: " + nonVegMeal.TotalCost());

            Console.ReadLine();
        }
Beispiel #8
0
        static void Main(string[] args)
        {
            var builder    = new MealBuilder();
            var burgerMeal = builder.PrepareBurgerMeal();

            Console.WriteLine("BurgerMeal : ");
            burgerMeal.ShowItems();
            Console.WriteLine(burgerMeal.GetCost());

            Console.WriteLine();
            var chickenMeal = builder.PrepareChickenMeal();

            Console.WriteLine("ChickenMeal : ");
            chickenMeal.ShowItems();
            Console.WriteLine(chickenMeal.GetCost());


            Console.ReadLine();
        }
Beispiel #9
0
 public void setMealBuilder(MealBuilder mb)
 {
     this.mb = mb;
 }