Esempio n. 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();
        }
Esempio n. 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();
        }
Esempio n. 3
0
		static void Main()
		{
			//Thuc don trong ngay hom nay
			CanhChua canhChua = new CanhChua("Ca loc tuoi", "Qua thom vang", "Ca chua Da Lat", "Me chua");
			canhChua.HienThi();
			Available TrangThai_CanhChua = new Available(canhChua, 10);

			CaKhoTo caKho = new CaKhoTo("Ca loc tuoi", "Nuoc mam Phu Quoc", "Ot sung tuoi", "Hanh la Da Lat");
			caKho.HienThi();
			Available TrangThai_CaKho = new Available(caKho, 10);

			//Dat mon an
			TrangThai_CaKho.OrderItem("La Quoc Thang");
			TrangThai_CanhChua.OrderItem("La Quoc Thang");
			TrangThai_CaKho.OrderItem("Gordon Ramsay");
			TrangThai_CanhChua.OrderItem("Christine Ha");

			//Con lai
			TrangThai_CaKho.HienThi();
			TrangThai_CanhChua.HienThi();
			Console.ReadKey();
		}