Collaboration: individual assignment. Internet access allowed ONLY to your text, if you have the e-version, and the Java API.
This program uses the code developed/used in inclass lab 11. You can work from your solution or the solution provided by the instructor.
Add a copy method to the Stack class. This method returns a deep copy of a stack. A copy is deep if it contains exactly the same data as the original, but the copy and original share no memory. See the pictures below (extracted from http://www.cs.utexas.edu/~scottm/cs307/handouts/deepCopying.htm).
In picture on left, data is of a shallow copy of values, also known as an alias. In picture on the right data is a deep copy of values.
Signature of your copy method: public Stack copy()
To implement this method, you may use only stack data structures and stack operations/methods to complete this task. Create as many stacks as you need. If you can’t figure out how to do this on your own, or without googling it, ask the instructor for a hint. After a call to the copy method, the caller should have two identical stacks.
Develop a TestDriver program to demonstrate that Stack copy method works.
Add a reverse method to the TestDriver class. This method accepts an integer parameter and uses a Stack to return the integers values that is its reverse. For example, the reverse of 123 is 321. (Use integer / and % as necessary to pull the digits off and stack to reverse them and reconstruct as a new integer.)
Create a folder named by yourlastnameHW8, put your files in that folder (partial submissions are better than no submission), zip/compress that folder, and upload to OAKS before the deadline.