Using the following UML diagram and class description, write a class named MyQueue which implements a pointer-based Queue. Class Attributes:Node is a private nested struct. It’s members are:i – stores an integer value.next – stores the memory address of the next node in the queue.front – The front node. Stores the memory address of the first node in the queueback – The last node. Stores the memory address of the last node in the queue.Constructor – initializes front and back to null.Destructor – frees all memory used by the queue.isEmpty – returns true if the queue is empty, false otherwise.isFull – returns true if there isn’t enough memory for a new node, false otherwise.enqueue – accepts an integer as it’s only argument. The value is added to the end of the queue. Returns 0 if successful, -1 otherwise. Can’t enqueue if you can’t make a new node.dequeue – removes the first node from the queue, freeing the it’s memory. Returns 0 if successful, -1 otherwise. Can’t dequeue from an empty list.first – stores the first value in the queue to it’s reference parameter, if the queue isn’t empty. Returns 0 if successful, -1 otherwise. Will fail if the queue is empty.last – stores the last value in the queue to it’s reference parameter, if the queue isn’t empty. Returns 0 if successful, -1 otherwise. Will fail if the queue is empty.Notes:The class does not interact with the user in any way, so no cin or cout statements. All accessors should be marked const.struct Node is nested in the class and is private.Hints:Save yourself from writing duplicate code by having the class destructor repeatedly call the dequeue method.You can use this driver (see file upload) to get you started on testing.Submission Details:Place your class in it’s own header file named MyQueue.h.Submit only this file. Be sure to include preprocess guards( #ifndef, #define, #endif).
Unformatted Attachment Preview
using namespace std;
int x, y;
cout << x << ", " << y << endl; m.dequeue(); m.dequeue(); m.first(x); cout << x << endl; while(!m.isEmpty()) m.dequeue(); } ... Purchase answer to see full attachment
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more