Пример #1
0
 public void printMenu() {
   MenuItem menuItem;
   for (int i = 0, len = cakeitems.size(); i < len; i++) {
     menuItem = cakeitems.get(i);
     System.out.println(
         menuItem.getName() + "***" + menuItem.getPrice() + "***" + menuItem.getDescription());
   }
   for (int i = 0, len = mDinerMenu.numberOfItems; i < len; i++) {
     menuItem = dineritems[i];
     System.out.println(
         menuItem.getName() + "***" + menuItem.getPrice() + "***" + menuItem.getDescription());
   }
 }
Пример #2
0
 void printMenu(Iterator iterator) {
   while (iterator.hasNext()) {
     MenuItem menuItem = (MenuItem) iterator.next();
     System.out.print(menuItem.getName() + ", ");
     System.out.print(menuItem.getPrice() + " -- ");
     System.out.println(menuItem.getDescription());
   }
 }
Пример #3
0
 private void printVegetarianMenu(Iterator iterator) {
   while (iterator.hasNext()) {
     MenuItem menuItem = (MenuItem) iterator.next();
     if (menuItem.isVegetarian()) {
       System.out.print(menuItem.getName());
       System.out.println("\t\t" + menuItem.getPrice());
       System.out.println("\t" + menuItem.getDescription());
     }
   }
 }
 public final Object[][] getMenuData() {
   int rowCount = customerMenu.getItemCount();
   Object[][] out = new Object[rowCount][3];
   MenuItem temp;
   ArrayList<Integer> itemIDs = customerMenu.getItemIds();
   for (int i = 0; i < rowCount; i++) {
     temp = customerMenu.getItemByID(itemIDs.get(i));
     out[i][0] = temp.getName();
     out[i][1] = temp.getDescription();
     out[i][2] = temp.getPrice();
   }
   return out;
 }