Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program for the class implementation of a queue using an array of SIZE = 10 elements. Your routines should not declare an

Write a C++ program for the class implementation of a queue using an array of SIZE = 10 elements. Your routines should not declare an overflow (queue full) unless every slot in the array is used. (DO NOT USE C++ STL queue ADT)

Clearly define your class with member functions and private data area. Class private data area only contain trackers front, rear and the array[SIZE]. Use the data file named CircularArrayQueue.data and process each command in the data file as follows..

Input Line Command to execute

e 10 enqueue(10) put 10 into the queue. d 99 dequeue() print the value returned by the call (or a message) p 99 displayQueue() print valid values in queue. f 99 front() print out the element at the front of the queue. t 99 isEmpty() print out Queue is Empty message (or a message) l 99 isFull() Print out Queue is Full message (or a message) c 99 countQ() print out Number of elements in queue is: nn x 99 exit the program.

Use a circular array implementation to create a minimum of following routines as member functions in your class definition. Enhance your class as needed by adding member functions.

1. enqueue() - Insert an element at the end of the queue called "rear". 2. eequeue() - Delete and return the element at the start of the queue called "front" 3. diplayQueue() - Print the values in the queue from front to rear. 4. front() - return the value stored in the front of the queue 5. isEmptyQ() - Return true if queue is empty, otherwise false. 6. iIsFullQ() - Return true if queue is full, otherwise false. 7. countQ() - Return Number of valid elements in queue

Programming standard explained in class must be strictly followed. In an event of an exception call (example: enqueue() call to a full queue, dequeue() or front() call to an empty queue), you should print an error message and continue processing the data from the data file.

Sample Output:

Step Action 1 enqueue() called with value 80. Status: Inserted value 80. . . 9 countQ() called. Number of elements in queue = 8 . . 13 displayQueue() called. Values in queue = 80, 81, .......

C++ PROGRAMMING HELP!!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

What are the advantages of fly - by - wire flight control systems

Answered: 1 week ago