001package headfirst.iterator.dinermergeri; 002 003import java.util.ArrayList; 004import java.util.Iterator; 005 006@SuppressWarnings("rawtypes") 007public class PancakeHouseMenu implements Menu { 008 ArrayList<MenuItem> menuItems; 009 010 public PancakeHouseMenu() { 011 menuItems = new ArrayList<MenuItem>(); 012 013 addItem("K&B's Pancake Breakfast", 014 "Pancakes with scrambled eggs, and toast", 015 true, 016 2.99); 017 018 addItem("Regular Pancake Breakfast", 019 "Pancakes with fried eggs, sausage", 020 false, 021 2.99); 022 023 addItem("Blueberry Pancakes", 024 "Pancakes made with fresh blueberries, and blueberry syrup", 025 true, 026 3.49); 027 028 addItem("Waffles", 029 "Waffles, with your choice of blueberries or strawberries", 030 true, 031 3.59); 032 } 033 034 public void addItem(String name, String description, 035 boolean vegetarian, double price) 036 { 037 MenuItem menuItem = new MenuItem(name, description, vegetarian, price); 038 menuItems.add(menuItem); 039 } 040 041 public ArrayList getMenuItems() { 042 return menuItems; 043 } 044 045 public Iterator createIterator() { 046 return menuItems.iterator(); 047 } 048 049 // other menu methods here 050}