public class Queue
{
	int DEFAULT_MAX_SIZE = 100;
	int [] queue = new int[DEFAULT_MAX_SIZE];
	int head = -1;	//the index of the head data element
	int tail = -1;	//the index of the tail data element
	
	public Queue()
	{
		
	}
	
	public Queue(int size)
	{
		queue = new int[size];
	}
	
	public void add(int data)
	{
		if (head == -1)
			head = 0;
		
		if (!isFull())
		{
			tail++;
			queue[tail] = data;
		}
	}
	
	public int remove()
	{
		if (!isEmpty())
		{
			int oldHead = head;
			head++;
			
			//PROBLEM: Our queue shrinks as we continuously add and remove
			//So if our head ever reaches the end, then we wrap the queue
			//around by resetting the head to 0
			return queue[oldHead];
		}
		
		return -999;
	}
	
	public void print()
	{
		for (int i = 0; i < queue.length; i++)
		{
			System.out.print(queue[i]);
			if (i == head)
				System.out.println(" " + "<= head");
			else if (i == tail)
				System.out.println(" " + "<= tail");
			else
				System.out.println();
		}
	}
	
	public boolean isFull()
	{
		if (tail == queue.length-1)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	
	public boolean isEmpty()
	{
		if (tail == head)
		{
			return true;
		}
		else
		{
			return false;
		}
		
		//return tail == head;
	}
}