Exemplo n.º 1
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();
        }
Exemplo n.º 2
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();
		}