Question
A Node ADT which will have two attributes - a data attribute and a pointer attribute. Remember the Node has to be an ADT, so
A Node ADT which will have two attributes - a data attribute and a pointer attribute. Remember the Node has to be an ADT, so that it can hold any kind of data.
You can choose to use this node as both a data and a head-pointing node or as a simple data node in which case you will need a new head pointing node.
A Singly Linked List ADT which will be composed of one or more of your nodes. Implement the most common linked-list behaviors as explained in class - new list, add anywhere, delete anywhere, find anywhere, count of items in the list, empty the list, etc.
Finally, implement a Stack ADT derived from your singly linked list which will implement the most common Stack operations like push, pop, isempty etc. and only expose them, i.e. a Stack object should not allow LinkedList behaviors to be executed on it.
Ensure that your Node, List and Stack ADTs are mimimal and cohesive with adequate walls around them. Define interfaces as needed, so you can reuse them in all your subsequent assignments.
Then write a main that will demonstrate the capabilities of you Stack ADT with different types of data - numbers, strings and your "Dollar" currency objects from Lab 1. Make sure that your currency files are not edited to fit the needs of this lab - I have the previous ones to compare.
Remember the template class code cannot be split into .h and .cpp files - you need to define them in one file and you can give it the .h extension. Create separate code files for Node, List and Stack ADTs
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