Your assignment is to create and test a class for a queue of objects. You may us
ID: 3759615 • Letter: Y
Question
Your assignment is to create and test a class for a queue of objects. You may use any object class of your choice as the data for the queue. The instances of the class should have at least one field that distinguishes each instance from other instances of the class (key property, also called a key field).This assignment requires four classes – Queue, QueueElement, the data object class, and a class for your test project.
Your queue class should maintain a head pointer to the first element in the queue, a tail pointer to the last element in the queue, and the size of the queue as queue properties.
You should have methods to:
instantiate a null queue
enqueue – add an element to the queue
dequeue – remove an element from the queue
size – return the size of the queue
a boolean isEmpty method
You will need to create a class of nodes for the data in the queue, which we call a queueElement.
Each queueElement should have data and a pointer to the next queueElement.
We need:
A null constructor (default)
An initializing constructor (instantiates a queueElement from a data element)
and methods to :
set the data in a queue element
return the data in a queue element
set the pointer to the next element
return the pointer to the next element
Explanation / Answer
instantiate a null queue
enqueue – add an element to the queue
dequeue – remove an element from the queue
size – return the size of the queue
a boolean isEmpty method
You will need to create a class of nodes for the data in the queue, which we call a queueElement.
Each queueElement should have data and a pointer to the next queueElement.
We need:
A null constructor (default)
An initializing constructor (instantiates a queueElement from a data element)
and methods to :
set the data in a queue element
return the data in a queue element
set the pointer to the next element
return the pointer to the next element
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.