Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!