GU FullStack Classes Programming Code

Use the stackADT class and stackType classes given to you in Ch. 18 and code supplied here to complete this assignment.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

#include

#include “myStack.h”

using namespace std;

int main()

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

{

stackType stack1(50);

stackType stack2(50);

stack1.initializeStack();

stack1.push(23);

stack1.push(45);

stack1.push(38);

stack2 = stack1;

if (stack1 == stack2)

cout << "stack1 and stack2 are identical" << endl;

else

cout << "stack1 and stack2 are not identical" << endl;

stack2.pop();

stack2.push(32);

cout << "**** After pop and push operations on stack2 ****" << endl;

if (stack1 == stack2)cout << "stack1 and stack2 are identical" << endl;elsecout << "stack1 and stack2 are not identical" << endl;

stack2.push(11);

cout << "**** After another push operation on stack2 ****" << endl;

if (stack1 == stack2)cout << "stack1 and stack2 are identical" << endl;elsecout << "stack1 and stack2 are not identical" << endl;

return 0;

}

Modify the stack implementation such that it uses a vectors as the container instead of an array.

Overload the pure virtual function push such that it takes a vector as an argument which pushes multiple values onto the stack.

Throw exceptions when:

An attempt is made to pop from an empty stack (display message)

An attempt is made to push onto a full stack (display message)

top() is called on an empty stack (display message).

A negative or zero value for stack size is passed to the constructor (In this case, when handling the error, automatically recall the constructor with a value of 100).

Using the STL queue container, add multiple stackType classes to a queue. Demonstrate an ability to use STL queue methods such as front() and pop().

ASSIGNMENT

Please pay careful attention to all assignment requirements. You are graded on your ability to implement each requirement.

In Week 8 we be modifying code given to you in Chapter 18 of the book and testing your ability to use the classes as intended.

See the assignment requirements for required modifications to the classes given.

The Stack classes given to you in Chapter 18 are using an array as the data structure to contain the data in the stack.      Your job is to modify this code so that a vector is used to contain the data instead.

i.e.

Replace this

Type *list;

with this

vector list;

Then modify the rest of the code to work with that vector syntax instead of the array pointer syntax.

You will also be adding exception handling for four scenarios.

Finally, be sure to see the section on testing the STL queue class as part of your main program. Use your stack Classes to add to a queue and demonstrate some common STL queue methods.

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER