Use the following file:
StackTester.java
/**
A tester program for the Stack class.
*/
public class StackTester
{
public static void main(String[] args)
{
Stack s = new Stack();
for (int i = 1; i <= 1000; i++)
s.push(new Integer(i));
for (int i = 1; i <= 500; i++)
s.pop();
System.out.println(s.pop());
System.out.println("Expected: 500");
System.out.println(s.peek());
System.out.println("Expected: 499");
System.out.println(s.size());
System.out.println("Expected: 499");
while (!s.empty()) s.pop();
System.out.println(s.size());
System.out.println("Expected: 0");
}
}