Assignment: #Q Due: 04/02/2017 Points: 5

Specification

Design and implement a class Q that uses Q.java as a code base. The queue ADT must use class LinkedList from Oracle's Java class library and its underlying data structure (i.e. every Q object has-a (contains) class LinkedList object. class Q is not allowed to extend class LinkedList.

The methods that are to be implemented are documented in Q.java. Method comment blocks are used to document the functionality of the class Q instance methods.

The output of your program must match the following. The already coded main() method should not need any modifications

*** test enqueue() ***
1st...enqueued
2nd...enqueued
3rd...enqueued
4th...enqueued
5th...not enqueued
[1st, 2nd, 3rd, 4th]
...size: 4; capacity: 4; isFull(): true; isEmpty(): false

*** test front() and dequeue() ***
front(): 1st; dequeue(): 1st
front(): 2nd; dequeue(): 2nd
front(): 3rd; dequeue(): 3rd
front(): 4th; dequeue(): 4th
[]
...size: 0; capacity: 4; isFull(): false; isEmpty(): true

*** test front() when Q empty... passed ***

*** test clear() ***
before: [James, Gosling]
...size: 2; capacity: 4; isFull(): false; isEmpty(): false
after: []
...size: 0; capacity: 4; isFull(): false; isEmpty(): true

*** test split() odd size ***
before split(): [1, 2, 3, 4, 5, 6, 7]
...size: 7; capacity: 16; isFull(): false; isEmpty(): false
after split(): [1, 2, 3]
...size: 3; capacity: 16; isFull(): false; isEmpty(): false
new Q: [4, 5, 6, 7]
...size: 4; capacity: 16; isFull(): false; isEmpty(): false

*** test split() even size ***
before split(): [0, 1, 2, 3, 4, 5, 6, 7]
...size: 8; capacity: 16; isFull(): false; isEmpty(): false
after split(): [0, 1, 2, 3]
...size: 4; capacity: 16; isFull(): false; isEmpty(): false
new Q: [4, 5, 6, 7]
...size: 4; capacity: 16; isFull(): false; isEmpty(): false

*** test split() empty Q ***
before split(): []
...size: 0; capacity: 4; isFull(): false; isEmpty(): true
after split(): []
...size: 0; capacity: 4; isFull(): false; isEmpty(): true
new Q: []
...size: 0; capacity: 4; isFull(): false; isEmpty(): true

*** test split() size=1 Q ***
before split(): [foo]
...size: 1; capacity: 4; isFull(): false; isEmpty(): false
after split: [foo]
...size: 1; capacity: 4; isFull(): false; isEmpty(): false
new Q: []
...size: 0; capacity: 4; isFull(): false; isEmpty(): true