Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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 cout

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

What is a strata-specific measure of effect?

Answered: 1 week ago

Question

What do you like to do for fun/to relax?

Answered: 1 week ago

Question

Different types of Grading?

Answered: 1 week ago

Question

Explain the functions of financial management.

Answered: 1 week ago

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago