Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment#2: Stacks and Queues Problem Statement: Based on the queueType class we develop in chapter 8, you are asked to add the following operations: 1.

Assignment#2: Stacks and Queues Problem Statement: Based on the queueType class we develop in chapter 8, you are asked to add the following operations:

1. Modify the addQueue operation to be addOrder, so that the items will be inserted into the queue in ascending order.

2. Add moveNthFront function as a none-member function to move the nth element of the queue to the front.

3. Add mirrorQueue function as a none-member function to duplicate the items in the queue in reverse order.

Programing Specifications:

1. Your are asked to develop a class named queueType with the following set of member functions:

A class constructor to initialize the data members.

The removeQueue function to remove an item from the queue.

The front function to return the item at the front of the queu.

The addOrder function to insert new value into the queue in its position such that all elements in the queue are in ascending order.

2. Your are asked to develop the following none-member functions:

The moveNthFront function that takes as a parameter a positive integer, n. The function moves the nth element of the queue to the front. The order of the remaining elements remains unchanged. For example, suppose queue = {5, 11, 34, 67, 43, 55} and n = 3. After a call to the function moveNthFront, queue = {34, 5, 11, 67, 43, 55}.

The mirrorQueue function that duplicate the content of the queue in reverse order. For example, suppose queue = {10, 20, 30, 40, 50}. After a call to the function mirrorQueue, queue = {10, 20, 30, 40, 50, 50, 40, 30, 20, 10}. Important Notes:

You are asked to implement the mirrorQueue / moveNthFront functions using stack and queue objects only, any other structures are not allowed.

( Hint : Declare stack and queue structures defined in C++ STL )

Assignment#2 Submission Notes:

PLEASE I WANT A FULL CODE THAT COMPILES WITH EVERY PART OF THE CLASS IN THERE, NOT PARTS OF THE ASSIGNMENT, THAAAAAANK U IN ADVANCE

Your assignment must compile in order to be graded.

Comment should be written all over the program.

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 Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions