Practice: Array Stacks

Take out a piece of paper. We’ll be programming on paper.

Write Java code for the following problem.

Problem 1

Implement the ArrayStack class:

public interface Stack211<E> {
  boolean empty();
  E peek();
  E pop();
  E push(E item);
}

public class ArrayStack<E> implements Stack211<E> {
  private E[] data;
  private int top;

  // your code here.

}

Problem 2

Answer the following questions:

Show me your code before you leave