<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
/**
 * Minimal dynamic-array-based queue with no error checking.
 *
 * @author CS 240 Instructors + ??
 * 
 *         (This is a lightly modified version of the zyBook implementation)
 *
 */
public class ArrayQueue&lt;E&gt; implements Queue&lt;E&gt; {

  private static final int INITIAL_CAPACITY = 1;

  /*
   * ArrayQueue is organized as a circular array:
   * 
   * The item that will be dequeued next is stored at `frontIndex`. The `length`
   * variable stores the number of elements currently in the queue. The index
   * where the next element should be enqueued is: `(frontIndex + length) %
   * array.length`
   */
  protected E[] array;
  private int frontIndex;
  private int length;

  /**
   * Create an unbounded circular-array based queue.
   */
  @SuppressWarnings("unchecked")
  public ArrayQueue() {
    array = (E[]) new Object[INITIAL_CAPACITY];
    length = 0;
    frontIndex = 0;
  }

  @Override
  public void enqueue(E item) {

    // TODO: IMPLEMENT THIS METHOD.

  }

  @Override
  public E dequeue() {

    // TODO: IMPLEMENT THIS METHOD.
    return null;

  }

  @Override
  public E peek() {

    // TODO: IMPLEMENT THIS METHOD.
    return null;
    
  }

  @Override
  public boolean isEmpty() {
    return length == 0;
  }

  @Override
  public int size() {
    return length;
  }
}
</pre></body></html>