// A Stack that contains Person objects. public class Stack { final int SIZE = 200; Person[ ] array; int top; public Stack( ) { array = new Person[SIZE]; top = -1; } public boolean isEmpty( ) { return top == -1; } public boolean isFull( ) { return top == SIZE - 1; } public Person getTop( ) { if (!isEmpty( )) return array[top]; else return null; } public void push(Person p) { if (!isFull( )) array[++top] = p; } public void pop( ) { if (!isEmpty( )) top--; } public String toString( ) { String output = "Contents of Stack object:\r\n"; for(int i = top; i >= 0; i--) { output += i + ": "; output += array[i].toString( ); output += "\r\n"; } return output; } }