1.  
  2. public class GroceryList {
  3.  
  4. static final int maxitems = 10;
  5. int items=0;
  6.  
  7. public static void main(String[] args) {
  8.  
  9. }
  10.  
  11. public GroceryList() {
  12. // constructs list
  13. list = new char[3][10];
  14.  
  15. }
  16.  
  17. public void add(GroceryItemOrder item) {
  18. if (items == 10) {
  19. break;
  20. } else {
  21. list[items] =
  22. items++;
  23. }
  24.  
  25. }
  26.  
  27. public double getTotalCost() {
  28. double sum;
  29. for (int i=0; i <= items; i++) {
  30. sum = getCost(list[3][i]) + sum;
  31. }
  32. return sum;
  33. }
  34.  
  35. public String toString() {
  36. return quantity + " of " + name;
  37. }
  38.  
  39.  
  40. }