This is for java just get as close to the UML as you think U

This is for java just get as close to the UML as you think.

UML DIAGRAM FOR AND DISCUSSION FOR Queue

Queue<E extends Comparable<E>>

private LinkedList<E> list

<<constructor>> Queue()

<<constructor>> Queue(name : String)

+ enqueue(item : E)

+ dequeue() : E

+ lengthIs() : int

+ peek() : E

+ toString() : String

+ isEmpty() : Boolean

+ clear()

Notes on Queue

The composition technique of Queue is being used. That is, Queue HAS-A LinkedList, as opposed to the inheritance technique where Queue IS-A LinkedList

The implementation of the methods is as discussed and demonstrated in class.

Queue<E extends Comparable<E>>

private LinkedList<E> list

<<constructor>> Queue()

<<constructor>> Queue(name : String)

+ enqueue(item : E)

+ dequeue() : E

+ lengthIs() : int

+ peek() : E

+ toString() : String

+ isEmpty() : Boolean

+ clear()

Solution

Please find the required program along with its output. Please see the comments against each line to understand the step.

---------------------------------------------------

OUTPUT:

[5, 7, 1, 9]
[7, 1, 9]
Length: 3
After clear : isEmpty: true

This is for java just get as close to the UML as you think. UML DIAGRAM FOR AND DISCUSSION FOR Queue Queue<E extends Comparable<E>> private LinkedLi
This is for java just get as close to the UML as you think. UML DIAGRAM FOR AND DISCUSSION FOR Queue Queue<E extends Comparable<E>> private LinkedLi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site