Programming solution




Write a program in C++, and implement a link-based Stack ADT. the program needs the following:

  1. 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.
  2. 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. For the head-pointing node, please implement both front and rear pointers, even if you may not need to use them.
  3. 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.
  4. Finally, implement a Stack ADT based on your singly linked list which will implement the most common Stack operations like push, pop, isempty etc.
  5. 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.
  6. Then write a main that will demonstrate the capabilities of you Stack ADT with different types of data – numbers, strings and your currency objects.