|
| 1 | +package headfirst.composite.menu; |
| 2 | + |
| 3 | +import java.util.*; |
| 4 | + |
| 5 | +public class MenuTestDrive { |
| 6 | + public static void main(String args[]) { |
| 7 | + MenuComponent pancakeHouseMenu = |
| 8 | + new Menu("PANCAKE HOUSE MENU", "Breakfast"); |
| 9 | + MenuComponent dinerMenu = |
| 10 | + new Menu("DINER MENU", "Lunch"); |
| 11 | + MenuComponent cafeMenu = |
| 12 | + new Menu("CAFE MENU", "Dinner"); |
| 13 | + MenuComponent dessertMenu = |
| 14 | + new Menu("DESSERT MENU", "Dessert of course!"); |
| 15 | + MenuComponent coffeeMenu = new Menu("COFFEE MENU", "Stuff to go with your afternoon coffee"); |
| 16 | + |
| 17 | + MenuComponent allMenus = new Menu("ALL MENUS", "All menus combined"); |
| 18 | + |
| 19 | + allMenus.add(pancakeHouseMenu); |
| 20 | + allMenus.add(dinerMenu); |
| 21 | + allMenus.add(cafeMenu); |
| 22 | + |
| 23 | + pancakeHouseMenu.add(new MenuItem( |
| 24 | + "K&B's Pancake Breakfast", |
| 25 | + "Pancakes with scrambled eggs, and toast", |
| 26 | + true, |
| 27 | + 2.99)); |
| 28 | + pancakeHouseMenu.add(new MenuItem( |
| 29 | + "Regular Pancake Breakfast", |
| 30 | + "Pancakes with fried eggs, sausage", |
| 31 | + false, |
| 32 | + 2.99)); |
| 33 | + pancakeHouseMenu.add(new MenuItem( |
| 34 | + "Blueberry Pancakes", |
| 35 | + "Pancakes made with fresh blueberries, and blueberry syrup", |
| 36 | + true, |
| 37 | + 3.49)); |
| 38 | + pancakeHouseMenu.add(new MenuItem( |
| 39 | + "Waffles", |
| 40 | + "Waffles, with your choice of blueberries or strawberries", |
| 41 | + true, |
| 42 | + 3.59)); |
| 43 | + |
| 44 | + dinerMenu.add(new MenuItem( |
| 45 | + "Vegetarian BLT", |
| 46 | + "(Fakin') Bacon with lettuce & tomato on whole wheat", |
| 47 | + true, |
| 48 | + 2.99)); |
| 49 | + dinerMenu.add(new MenuItem( |
| 50 | + "BLT", |
| 51 | + "Bacon with lettuce & tomato on whole wheat", |
| 52 | + false, |
| 53 | + 2.99)); |
| 54 | + dinerMenu.add(new MenuItem( |
| 55 | + "Soup of the day", |
| 56 | + "A bowl of the soup of the day, with a side of potato salad", |
| 57 | + false, |
| 58 | + 3.29)); |
| 59 | + dinerMenu.add(new MenuItem( |
| 60 | + "Hotdog", |
| 61 | + "A hot dog, with saurkraut, relish, onions, topped with cheese", |
| 62 | + false, |
| 63 | + 3.05)); |
| 64 | + dinerMenu.add(new MenuItem( |
| 65 | + "Steamed Veggies and Brown Rice", |
| 66 | + "Steamed vegetables over brown rice", |
| 67 | + true, |
| 68 | + 3.99)); |
| 69 | + |
| 70 | + dinerMenu.add(new MenuItem( |
| 71 | + "Pasta", |
| 72 | + "Spaghetti with Marinara Sauce, and a slice of sourdough bread", |
| 73 | + true, |
| 74 | + 3.89)); |
| 75 | + |
| 76 | + dinerMenu.add(dessertMenu); |
| 77 | + |
| 78 | + dessertMenu.add(new MenuItem( |
| 79 | + "Apple Pie", |
| 80 | + "Apple pie with a flakey crust, topped with vanilla icecream", |
| 81 | + true, |
| 82 | + 1.59)); |
| 83 | + |
| 84 | + dessertMenu.add(new MenuItem( |
| 85 | + "Cheesecake", |
| 86 | + "Creamy New York cheesecake, with a chocolate graham crust", |
| 87 | + true, |
| 88 | + 1.99)); |
| 89 | + dessertMenu.add(new MenuItem( |
| 90 | + "Sorbet", |
| 91 | + "A scoop of raspberry and a scoop of lime", |
| 92 | + true, |
| 93 | + 1.89)); |
| 94 | + |
| 95 | + cafeMenu.add(new MenuItem( |
| 96 | + "Veggie Burger and Air Fries", |
| 97 | + "Veggie burger on a whole wheat bun, lettuce, tomato, and fries", |
| 98 | + true, |
| 99 | + 3.99)); |
| 100 | + cafeMenu.add(new MenuItem( |
| 101 | + "Soup of the day", |
| 102 | + "A cup of the soup of the day, with a side salad", |
| 103 | + false, |
| 104 | + 3.69)); |
| 105 | + cafeMenu.add(new MenuItem( |
| 106 | + "Burrito", |
| 107 | + "A large burrito, with whole pinto beans, salsa, guacamole", |
| 108 | + true, |
| 109 | + 4.29)); |
| 110 | + |
| 111 | + cafeMenu.add(coffeeMenu); |
| 112 | + |
| 113 | + coffeeMenu.add(new MenuItem( |
| 114 | + "Coffee Cake", |
| 115 | + "Crumbly cake topped with cinnamon and walnuts", |
| 116 | + true, |
| 117 | + 1.59)); |
| 118 | + coffeeMenu.add(new MenuItem( |
| 119 | + "Bagel", |
| 120 | + "Flavors include sesame, poppyseed, cinnamon raisin, pumpkin", |
| 121 | + false, |
| 122 | + 0.69)); |
| 123 | + coffeeMenu.add(new MenuItem( |
| 124 | + "Biscotti", |
| 125 | + "Three almond or hazelnut biscotti cookies", |
| 126 | + true, |
| 127 | + 0.89)); |
| 128 | + |
| 129 | + Waitress waitress = new Waitress(allMenus); |
| 130 | + |
| 131 | + waitress.printMenu(); |
| 132 | + } |
| 133 | +} |
0 commit comments