Question
Create a user-Defined Abstract Data Type named Queue - Use an appropriate set of C++ header/implementation files - Queue is implemented as a dynamically allocated
Create a user-Defined Abstract Data Type named Queue
- Use an appropriate set of C++ header/implementation files
- Queue is implemented as a dynamically allocated array
-implemented as a circular queue
- queue consists of 0 or more QElement values
- QElement is an exportable standard library double data type
Exportable operations: (declared in .h file & defined in .cpp file) - (+) implement a minimum number of constructor functions - (*) before an element can be accessed and process it must first be removed from the front of queue.
Queue - default constructor function - creates an initialized empty queue (+), default size of 3
Queue - overloaded/parameterized constructor - creates an initialized empty queue(+), user specified size
Queue - Copy constructor - creates a duplicate copy of an existing queue (*)
~Queue - Destructor function - destroys the existing queue, queue instance state before going out of scope - initialized empty queue
enQueue - inserts a new element to the back of the queue
deQueue - removes an existing element from the front of the queue
view - displays the contents of the queue from the front to the back (*)
isEmpty - returns true if the current queue instance is empty - false otherwise
isFull - returns true if the current queue instance is full - false otherwise
User-Defined Data Types
QElement
Qpointer
Queue output(view)
Beginning -> End
Beginning -> 4.34 -> -4.5 -> End
Required header file (.h). // only partially specified // General description of the ADT and supported operations - exportable operations only // Do not include any implementation details #ifndef_QUEUE_H #define _QUEUE H typedef double QElement; class Queue { public: // exportable // General description of each of the ADT operations/functions - exportable operations only Queue (...); Queue(Queue & ); -Queue(): }; void enQueue( const Element); void deQueue( QElement & ); void view(); #endif // Guard typedef QElement * QPointer; QPointer queue; short front, back; bool isEmpty() const; bool isFull) const; // replace ... with required arguments private: // No private member documentation - implementation details are hidden/abstracted away const short Q_SIZE; // must be initializaed // reuse enQueue & de Queue // reuse deQueue // reuse enQueue & de Queue // non-exportable // Guard
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Queueh ifndef QUEUEH define QUEUEH typedef double QElement class Queue public Queue default construc...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started