Finish the provided specifications for the Word and WordStack classes. The WordStack Class will act as a stack of Word objects. You must implement your own linked list for this assignment. Additionally create a driver to demonstrate the features of the WordStack class. The driver will read and write files to reverse all of the words of some input file.
Finish the Word class implementation in Word.cpp
Use the provided Word.h. Complete the implementation of the Word class in a Word.cpp file.
Finish the WordStack class in WordStack.cpp
Use the provided WordStack.h. Complete the implementation of the WordStack class in a WordStack.cpp file.
Create a WordStack class with pop, push, and isEmpty.
This Wordstack holds Word objects using a linked list of Nodes.
The Stack class has the following methods:
push accepts a Word object, then inserts it into the stack of Words
The pop() method takes no arguments and returns the Word object from the top of the stack. This method also discards the top element from the stack. Throw an exception when popping from an empty stack.
isEmpty returns True when the stack is empty. Return false when not empty.
Create a simple text file with some arbitrary text of your choice. This is the program input file.
Next, write a driver program to read an input file, save the words in a new file in reverse order. Do this using the WordStack class.
The Driver should do the following at minimum.
• Open the input text file and read the contents into a WordStack. This must insert one word at a time into the stack.
• Close the input file.
• Open a new file for program output. This file begins empty.
• The program should then pop all of the Words from the stack and save each word into an output file. This output file stores all of the words that were popped from the stack.
• Close the output file.
• The order of the words saved in the output file should be the reverse of their order in the input file.
This assignment has been answered 3 times in private sessions.
© 2023 Codify Tutor. All rights reserved