001package headfirst.iterator.dinermerger;
002
003import java.util.ArrayList;
004
005@SuppressWarnings("rawtypes")
006public class MenuTestDrive {
007        public static void main(String args[]) {
008                PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu();
009                DinerMenu dinerMenu = new DinerMenu();
010
011                Waitress waitress = new Waitress(pancakeHouseMenu, dinerMenu);
012
013                waitress.printMenu();
014        }
015
016        public static void printMenu() {
017                PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu();
018                DinerMenu dinerMenu = new DinerMenu();
019
020                ArrayList breakfastItems = pancakeHouseMenu.getMenuItems();
021
022                for (int i = 0; i < breakfastItems.size(); i++) {
023                        MenuItem menuItem = (MenuItem)breakfastItems.get(i);
024                        System.out.print(menuItem.getName());
025                        System.out.println("\t\t" + menuItem.getPrice());
026                        System.out.println("\t" + menuItem.getDescription());
027                }
028
029                MenuItem[] lunchItems = dinerMenu.getMenuItems();
030
031                for (int i = 0; i < lunchItems.length; i++) {
032                        MenuItem menuItem = lunchItems[i];
033                        System.out.print(menuItem.getName());
034                        System.out.println("\t\t" + menuItem.getPrice());
035                        System.out.println("\t" + menuItem.getDescription());
036                }
037        }
038}