Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var dinnerMenu    = new DinnerMenu();
            var breakfastMenu = new BreakfastMenu();
            var cafeMenu      = new CafeMenu();


            MenuComponent breakfastCMenu = new Menu("PANCAKE HOUSE", "Breakfast");
            MenuComponent dinnerCMenu    = new Menu("FINE DINING ITALIAN", "Dinner");
            MenuComponent coffeeCMenu    = new Menu("THE TEA HOSE", "Tea Time");
            MenuComponent foodCourtMenu  = new Menu("THE FOOD COURT - 24 Hours", "All day food");

            foodCourtMenu.add(breakfastCMenu);
            foodCourtMenu.add(dinnerCMenu);
            foodCourtMenu.add(coffeeCMenu);

            MenuItem pasta = new MenuItem(5, "Lunch: Pasta", "Pasta", false);
            MenuItem soup  = new MenuItem(10, "Lunch: Soup", "Soup", true);
            MenuItem salad = new MenuItem(15, "Lunch: Salda", "Salda", true);

            MenuItem tea     = new MenuItem(6, "Tea Time: Tea", "Tea", true);
            MenuItem biscuit = new MenuItem(9, "Tea Time: Biscuit", "Biscuit", false);
            MenuItem cake    = new MenuItem(12, "Tea Time: Cake", "Cake", false);

            MenuItem coffee = new MenuItem(11, "Breakfast: Coffee", "Coffee", true);
            MenuItem fruit  = new MenuItem(22, "Breakfast: Fruit", "Fruit", true);
            MenuItem muesly = new MenuItem(33, "Breakfast: Muesly", "Muesly", false);

            breakfastCMenu.add(coffee);
            breakfastCMenu.add(fruit);
            breakfastCMenu.add(muesly);

            dinnerCMenu.add(pasta);
            dinnerCMenu.add(soup);
            dinnerCMenu.add(salad);

            coffeeCMenu.add(tea);
            coffeeCMenu.add(biscuit);
            coffeeCMenu.add(cake);

            WaitressComposite superWaittress = new WaitressComposite(foodCourtMenu);

            superWaittress.printMenu();

            Console.ReadLine();

            var javaWaitress = new JavaWaitressIterator(breakfastMenu, dinnerMenu, cafeMenu);

            var dinnerOrderId    = javaWaitress.AddMenu(dinnerMenu);
            var breakfastOrderId = javaWaitress.AddMenu(breakfastMenu);
            var cafeOrderId      = javaWaitress.AddMenu(cafeMenu);

            javaWaitress.PrintOrder(dinnerOrderId);
            javaWaitress.PrintOrder(breakfastOrderId);
            javaWaitress.PrintOrder(cafeOrderId);

            javaWaitress.PrintOrders();

            javaWaitress.PrintOrdersWithIterators();

            Console.ReadLine();

            return;

            Console.WriteLine("Testing New Cafe Menu added");

            javaWaitress.printCafeMenu_WithEnumerator();

            javaWaitress.printCafeMenu_WithIterator();

            Console.ReadLine();
            return;

            Console.WriteLine("\nPrinting BREAKFAST MENU_____________________");
            javaWaitress.printBreakfastMenu_WithEnumerator();

            Console.WriteLine("\nPrinting LUNCH MENU_____________________");
            javaWaitress.printDinnerMenu_WithEnumerator();

            Console.WriteLine("\nPrinting ALL menu_____________________");
            javaWaitress.printMenu();

            Console.WriteLine("\nPrinting vegetarian dishes_____________________");

            Console.WriteLine("Item {0} is vegetarian: {1}", "Set A", javaWaitress.isItemVegetarian("Set A"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set B", javaWaitress.isItemVegetarian("Set B"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set C", javaWaitress.isItemVegetarian("Set C"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set D", javaWaitress.isItemVegetarian("Set D"));

            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set A", javaWaitress.isItemVegetarian("Dinner Set A"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set B", javaWaitress.isItemVegetarian("Dinner Set B"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set C", javaWaitress.isItemVegetarian("Dinner Set C"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set D", javaWaitress.isItemVegetarian("Dinner Set D"));

            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            var dinnerMenu = new DinnerMenu();
            var breakfastMenu = new BreakfastMenu();
            var  cafeMenu = new CafeMenu();

            MenuComponent breakfastCMenu = new Menu("PANCAKE HOUSE", "Breakfast");
            MenuComponent dinnerCMenu = new Menu("FINE DINING ITALIAN", "Dinner");
            MenuComponent coffeeCMenu = new Menu("THE TEA HOSE", "Tea Time");
            MenuComponent foodCourtMenu = new Menu("THE FOOD COURT - 24 Hours", "All day food");

            foodCourtMenu.add(breakfastCMenu);
            foodCourtMenu.add(dinnerCMenu);
            foodCourtMenu.add(coffeeCMenu);

            MenuItem pasta = new MenuItem(5, "Lunch: Pasta", "Pasta", false);
            MenuItem soup = new MenuItem(10, "Lunch: Soup", "Soup", true);
            MenuItem salad = new MenuItem(15, "Lunch: Salda", "Salda", true);

            MenuItem tea = new MenuItem(6, "Tea Time: Tea", "Tea", true);
            MenuItem biscuit = new MenuItem(9, "Tea Time: Biscuit", "Biscuit", false);
            MenuItem cake = new MenuItem(12, "Tea Time: Cake", "Cake", false);

            MenuItem coffee = new MenuItem(11, "Breakfast: Coffee", "Coffee", true);
            MenuItem fruit = new MenuItem(22, "Breakfast: Fruit", "Fruit", true);
            MenuItem muesly = new MenuItem(33, "Breakfast: Muesly", "Muesly", false);

            breakfastCMenu.add(coffee);
            breakfastCMenu.add(fruit);
            breakfastCMenu.add(muesly);

            dinnerCMenu.add(pasta);
            dinnerCMenu.add(soup);
            dinnerCMenu.add(salad);

            coffeeCMenu.add(tea);
            coffeeCMenu.add(biscuit);
            coffeeCMenu.add(cake);

            WaitressComposite superWaittress = new WaitressComposite(foodCourtMenu);

            superWaittress.printMenu();

            Console.ReadLine();

            var javaWaitress = new JavaWaitressIterator(breakfastMenu, dinnerMenu, cafeMenu);

            var dinnerOrderId = javaWaitress.AddMenu(dinnerMenu);
            var breakfastOrderId = javaWaitress.AddMenu(breakfastMenu);
            var cafeOrderId = javaWaitress.AddMenu(cafeMenu);

            javaWaitress.PrintOrder(dinnerOrderId);
            javaWaitress.PrintOrder(breakfastOrderId);
            javaWaitress.PrintOrder(cafeOrderId);

            javaWaitress.PrintOrders();

            javaWaitress.PrintOrdersWithIterators();

            Console.ReadLine();

            return;

            Console.WriteLine("Testing New Cafe Menu added");

            javaWaitress.printCafeMenu_WithEnumerator();

            javaWaitress.printCafeMenu_WithIterator();

            Console.ReadLine();
            return;

            Console.WriteLine("\nPrinting BREAKFAST MENU_____________________");
            javaWaitress.printBreakfastMenu_WithEnumerator();

            Console.WriteLine("\nPrinting LUNCH MENU_____________________");
            javaWaitress.printDinnerMenu_WithEnumerator();

            Console.WriteLine("\nPrinting ALL menu_____________________");
            javaWaitress.printMenu();

            Console.WriteLine("\nPrinting vegetarian dishes_____________________");

            Console.WriteLine("Item {0} is vegetarian: {1}", "Set A", javaWaitress.isItemVegetarian("Set A"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set B", javaWaitress.isItemVegetarian("Set B"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set C", javaWaitress.isItemVegetarian("Set C"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Set D", javaWaitress.isItemVegetarian("Set D"));

            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set A", javaWaitress.isItemVegetarian("Dinner Set A"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set B", javaWaitress.isItemVegetarian("Dinner Set B"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set C", javaWaitress.isItemVegetarian("Dinner Set C"));
            Console.WriteLine("Item {0} is vegetarian: {1}", "Dinner Set D", javaWaitress.isItemVegetarian("Dinner Set D"));

            Console.ReadLine();
        }