You should create two methods for a data structure implementing a Queue as a
circular array. Your data structure should have the class name MyArrayQueue. The
two methods that should be implemented are:
a) Adding element to the queue:
public void enqueue(Object theElement) {…}
[20 marks]
(Functionality: 15, Design: 2, Ease of use: 2, Presentation: 1)
b) Deleting an element from the queue and return the deleted element:
public Object dequeue() {…}
[10 marks]
(Functionality: 6, Design: 2, Ease of use: 1, Presentation: 1)
In both methods errors should be handled properly. For example what happens
when adding an element to a full queue?
There will be skeleton code for MyArrayQueue available on Learning central that
contains the MyArrayQueue class with the following fully implemented methods:
constructor, isEmpty(), getFrontElement(), getRearElement() methods. It also
includes signatures of two methods that you should implement: enqueue(Object
theElement) & dequeue().
Comments
Leave a comment