public DinnerMenuIterator(MenuItem[] items) { this.items = items; }
//added the index integer to be the Hashtable key value public void AddItem(string name, string description, bool isVegetarian, double price, int index) { MenuItem menuItem = new MenuItem(name, description, isVegetarian, price); menuItems.Add(index, menuItem); }
public void AddItem(string name, string description, bool isVegetarian, double price) { MenuItem menuItem = new MenuItem(name,description, isVegetarian,price); if(numberOfItems >= MAX_ITEMS) { Console.WriteLine("Sorry, menu is full! Can't add item to menu"); } else { menuItems[numberOfItems] = menuItem; numberOfItems += 1; } }