The standard Java library implements a Stack class, but in this exercise you are asked to provide your own implementation. Do not implement type parameters. Use an Object[] array to hold the stack elements. When the array fills up, allocate an array of twice the size and copy the values to the larger array.

Complete the following file:

Stack.java

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");
   }
}