Lab 13: Implementing an Abstract Data Type, Double Ended Queues
In this lab you will practice implementing an abstract data type. You should create a class called
DEQueue which is a double-ended queue (a queue that lets you add and remove from both ends).
Since this is an abstract data type, the implementation details should be hidden (i.e. private).
Your class should have the following constructor:
- public DEQueue(int size) that allocates a double ended queue of the
desired size,
and five public methods:
- public boolean isEmpty()
- public boolean isFull()
- public void enqueueFront (T element) throws QueueFullException
- public void enqueueBack (T element) throws QueueFullException
- public T dequeueFront() throws QueueEmptyException
- public T dequeueBack() throws QueueEmptyException
For this lab, you should implement the double ended queue as a circular array.
Because you are using generics with an array, you will get a unchecked cast warning when you
typecast the value stored in the array into the generic T. There is no good way to avoid this
warning, but this should be the only warning you have when compiling your code.
At the end of the lab, email your code to your instructor, hsc@albion.edu.