Beispiel #1
0
        /// <summary>
        /// We run a farm-fresh restaurant.
        /// That means that we can only make dishes which we have the ingredients for.
        /// Sometimes we run out of ingredients, so we can't make those dishes.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            //Step 1: Define some dishes, and how many of each we can make
            FreshSalad caesarSalad = new FreshSalad("Crisp romaine lettuce", "Freshly-grated Parmesan cheese", "House-made Caesar dressing");

            caesarSalad.Display();

            Pasta fettuccineAlfredo = new Pasta("Fresh-made daily pasta", "Creamly garlic alfredo sauce");

            fettuccineAlfredo.Display();

            Console.WriteLine("\nMaking these dishes available.");

            //Step 2: Decorate the dishes; now if we attempt to order them once we're out of ingredients, we can notify the customer
            Available caesarAvailable  = new Available(caesarSalad, 3);
            Available alfredoAvailable = new Available(fettuccineAlfredo, 4);

            //Step 3: Order a bunch of dishes
            caesarAvailable.OrderItem("John");
            caesarAvailable.OrderItem("Sally");
            caesarAvailable.OrderItem("Manush");

            alfredoAvailable.OrderItem("Sally");
            alfredoAvailable.OrderItem("Francis");
            alfredoAvailable.OrderItem("Venkat");
            alfredoAvailable.OrderItem("Diana");
            alfredoAvailable.OrderItem("Dennis"); //There won't be enough for this order.

            caesarAvailable.Display();
            alfredoAvailable.Display();

            Console.ReadKey();
        }
Beispiel #2
0
        static void FarmDecorator()
        {
            //Step 1: Define some dishes, and how many of each we can make
            FreshSaladDish caesarSalad = new FreshSaladDish("Crisp romaine lettuce", "Freshly-grated Parmesan cheese", "House-made Caesar dressing");

            caesarSalad.Display();

            PastaDish fettuccineAlfredo = new PastaDish("Fresh-made daily pasta", "Creamy garlic alfredo sauce");

            fettuccineAlfredo.Display();

            MeatDish MeatLoverPizza = new MeatDish(true, "Pepperoni", "American");

            MeatLoverPizza.Display();

            Console.WriteLine("\nMaking these dishes available.");

            //Step 2: Decorate the dishes; now if we attempt to order them once we're out of ingredients, we can notify the customer

            Available fettuciniAvailable = new Available(fettuccineAlfredo, 3);
            Available caeserAvailable    = new Available(caesarSalad, 4);
            Available meatAvailable      = new Available(MeatLoverPizza, 3);


            fettuciniAvailable = new Available(fettuccineAlfredo, 2);

            //Step 3: Order a bunch of dishes
            fettuciniAvailable.OrderItem("John");
            fettuciniAvailable.OrderItem("Sally");
            fettuciniAvailable.OrderItem("Manush");


            //fettuciniAvailable.OrderItem("Sally");
            //fettuciniAvailable.OrderItem("Lisa");
            //fettuciniAvailable.OrderItem("Hope");

            //meatAvailable.OrderItem("John");
            //meatAvailable.OrderItem("Bob");
            //meatAvailable.OrderItem("Larry");
            //meatAvailable.OrderItem("Trevor");


            caeserAvailable.Display();
            fettuciniAvailable.Display();
            meatAvailable.Display();
        }