public final class ArrayBag1 /* implements BagInterface //this should be here, but not all of the interface will be implemented in class*/ { private final T[] bag; private int numberOfEntries; public ArrayBag(int totalLength) { if (totalLength < 1) { throw new IllegalArgumentException("total length must be greater than 1"); } bag = (T[]) new Object[totalLength]; numberOfEntries = 0; } /** Adds a new entry to this bag. @param newEntry The object to be added as a new entry. @return True if the addition is successful, or false if not. */ public boolean add(T newEntry) { //is bag initialized? if (bag == null) { //does not exist return false; } //is the bag full? if (numberOfEntries == bag.length) { return false; } //use numberOfEntries as location for newEntry bag[numberOfEntries] = newEntry; numberOfEntries++; return true; } // end add /** Removes one occurrence of a given entry from this bag. @param anEntry The entry to be removed. @return True if the removal was successful, or false if not. */ public boolean remove(T anEntry) { //is bag initialized? if (bag == null) { //does not exist return false; } //is the bag empty? if (numberOfEntries == 0) return false; //does anEntry exist in bag? for (int i=0; i < numberOfEntries; i++) { //use numberOfEntries or bag.length if (bag[i].equals(anEntry) { //remove it } } } // end remove /** Removes one unspecified entry from this bag, if possible. @return Either the removed entry, if the removal was successful, or null. */ public T remove() { } // end remove } // end ArrayBag