Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a derived class for circular-queue by using previous exercise as base class. Derived class must have a constructor naturally to be able to set

image text in transcribed Write a derived class for circular-queue by using previous exercise as base class. Derived class must have a constructor naturally to be able to set length of queue. There will be a function in derived class which will be used to print on screen current state of queue array. If there is any location is occupied, value at that location will be written on screen, if location is empty, - symbol will be written as shown below (for 3 location queue),

Exercise Write a derived class for circular-queue by using previous exercise as base class. Derived class must have a constructor naturally to be able to set length of queue. There will be a function in derived class which will be used to print on screen current state of queue array. If there is any location is occupied, value at that location will be written on screen, if location is empty, -symbol will be written as shown below (for 3 location queue), Initial State After Adding After Adding After Removing After Adding 2 items 2 More Items 1 Item 1 More Item 10 20 OUTPUT 10 20 30 Queue is Full 20 30 40 20 30 10 TRY FOLLOWINGS 10 20 10 20 30 Queue is Full 10 20 30 20 30 40 20 30 int main() { cqueue (3); q.showqueue (); q. set (10); q.showqueue (); q. set (20); q.showqueue (); q. set (30); q.showqueue (); q. set (40); q.showqueue (); q.get(); q.showqueue (); q. set (40); q. showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); return 0; } 40 30 40 Queue is Empty Exercise Write a derived class for circular-queue by using previous exercise as base class. Derived class must have a constructor naturally to be able to set length of queue. There will be a function in derived class which will be used to print on screen current state of queue array. If there is any location is occupied, value at that location will be written on screen, if location is empty, -symbol will be written as shown below (for 3 location queue), Initial State After Adding After Adding After Removing After Adding 2 items 2 More Items 1 Item 1 More Item 10 20 OUTPUT 10 20 30 Queue is Full 20 30 40 20 30 10 TRY FOLLOWINGS 10 20 10 20 30 Queue is Full 10 20 30 20 30 40 20 30 int main() { cqueue (3); q.showqueue (); q. set (10); q.showqueue (); q. set (20); q.showqueue (); q. set (30); q.showqueue (); q. set (40); q.showqueue (); q.get(); q.showqueue (); q. set (40); q. showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); q.get(); q.showqueue (); return 0; } 40 30 40 Queue is Empty

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

More Books

Students also viewed these Databases questions