Starting from:
$30

$24

ASSIGNMENT 3 SOLUTION

For this assignment, you are to implement 2 generic Queues; one backed by a circular array, and other backed with a linked chain of objects (i.e., Node). You should implement the attached interface (Queue) and call your classes ArrayQueue and LinkedQueue. I have attached a JUnit test class that will test your implementations and output some performance measurements.

Grading:

25 points: your LinkedQueue and ArrayQueue both implement the interface and compile.
5 points: your code passes the testAddAndClear test.
5 points: your code passes the testAddAndRemove test.
5 points: your code passes the testBigaddAndRemove test.
10 points: style / implementation / grader's discretion.
Note: unfortunately as we have seen, Java does not allow you to instantiate a generic array. To get around this, the simplest approach is to use an array of Object (i.e., Object[] ) and cast any return values to T.

Note: remember to declare your classes as "public class ArrayQueue<T implements Queue<T" or public class LinkedQueue<T implements Queue<T " or you may get odd compile errors.

More products