001package headfirst.iterator.dinermergercafe;
002
003import java.util.Hashtable;
004import java.util.Iterator;
005
006@SuppressWarnings("rawtypes")
007public class CafeMenu implements Menu {
008        Hashtable<String,MenuItem> menuItems = new Hashtable<String,MenuItem>();
009
010        public CafeMenu() {
011                addItem("Veggie Burger and Air Fries",
012                                "Veggie burger on a whole wheat bun, lettuce, tomato, and fries",
013                                true, 3.99);
014                addItem("Soup of the day",
015                                "A cup of the soup of the day, with a side salad",
016                                false, 3.69);
017                addItem("Burrito",
018                                "A large burrito, with whole pinto beans, salsa, guacamole",
019                                true, 4.29);
020        }
021
022        public void addItem(String name, String description,
023                        boolean vegetarian, double price)
024        {
025                MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
026                menuItems.put(menuItem.getName(), menuItem);
027        }
028
029        public Hashtable getItems() {
030                return menuItems;
031        }
032
033        public Iterator createIterator() {
034                return menuItems.values().iterator();
035        }
036}