Answered step by step
Verified Expert Solution
Question
1 Approved Answer
TWO FILES C++ ONLY WILL RATE THANK YOU VERY MUCH ProducerConsumer Class **Beware of edge cases that arise from the array being circular** In this
TWO FILES C++ ONLY WILL RATE THANK YOU VERY MUCH
ProducerConsumer Class **Beware of edge cases that arise from the array being circular** In this class you will build a queue using the circular array implementation. Implement the methods of Producer Consumer according to the following specifications. staan in Pa std::string queue[SIZE] A circular queue of strings in the form of an array. SIZE is initialized to a default value of 20 in ProducerConsumer.hpp int queueFront Index in the array that keeps track of the front item int queue End Index in the array that keeps track of the first available empty space (in case the queue is full, queue End points to queueFront). ProducerConsumer() Constructor--Set queue Front and queue End to 0 bool isEmpty() Return true if the queue is empty, false otherwise Due Suruay, Marcin 1, 11.59PM bool isFull() Return true if the queue is full, false otherwise void enqueue(std::string item) If the queue is not full, then add the item to the end of the queue and modify queue Front and/or queueEnd if appropriate, else print "Queue full, cannot add new item" void dequeue() Remove the first item from the queue if the queue is not empty and modify queue Front and/or queue End if appropriate. Otherwise print "Queue empty, cannot dequeue an item" int queue Size() Return the number of items in the queue. std::string peek() If the queue is empty then print "Queue empty, cannot peek and return an empty string. Otherwise, return the first item in the queue. ProducerConsumer main driver file Your program will start by displaying a menu by calling the menu() function which is included in the provided skeleton code. The user will select an option from the menu to decide upon what the program will do, after which the menu will be displayed again. Below are the specifics of the menu (Tip: use getline for all inputs, the example is shown in the starter code.) Option 1: Producer (Produce items into the queue) - This is an enqueue operation This option prompts the user to enter the number of items being produced using the below print statement coutStep by Step Solution
There are 3 Steps involved in it
Step: 1
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