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