Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

student submitted image, transcription available below 

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Operating System questions

Question

- >y-

Answered: 1 week ago