Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirements: 1 . Use ONLY the templated DStack.h and LStack.h uploded into this directory. 2 . Keep the same names ( reverse , catStack and
Requirements:
Use ONLY the templated DStack.h and LStack.h uploded into this directory.
Keep the same names reverse catStack and length for the respective additional member
and nonmember functions.
Do not change any of the given identifiers of templated DStack.h and LStack.h
For definitions of member functions use only private data members; empty and full
are only two public member functions which can be used for member function definitions.
The full submission requires in total two.h files, two cpp files and two outputs images
which additionally include the new member function prototypes and definitions, the
prototype and definition of the new nonmember function and two screenshots as specified
in the submissions of Problem and Problem
No friend functions.
What to submit
manual writing of files below will not be accepted as well as files copied and pasted into a
doc or pdf document ; output should be taken as a snapshot.
Output can be submitted as an image or image pasted in doc. file
The h file twoh files are expected
The test or driver cpp file two cpp driver files are expected
Two outputs of the test drivers. The outputs images should have not less than lines.
Problem : max total points
a Design write the prototype points and implement write the definition points a new
templated member function catStack for Stack based on Linked Nodes LStackh Function
catStack creates a new stack by adding elements of one existing object of LStack class to another
existing object of the same class. Do not destroy both existing objects of LStack class.
max points
LStack.h
template
struct NodeType
ItemType info ;
NodeType next;
;
template
class Stack
public:
Stack ;
~Stack ;
Stack const Stack& original ;
void operatorStack &s;
void makeEmpty;
bool full const;
bool empty const;
void pushconst ItemType& item;
void popItemType& item;
void pop;
ItemType top const;
void print const;
private:
NodeType topPtr;
;
b Write a driver program which includes
the prototype points and definition points of a new nonmember function length for
LStack.h which returns the actual number of stack elements;
max points
main which creates objects storing different type of elements and uses all member
functions of the modified templated class Stack on linked nodes and the new nonmember
function. Submit the output screenshot submitted as an image having between lines.
max points for driver program; max points for the output
Submission of Problem a and b One h file, one cpp file and one screenshot image
Step 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