Quiz 8, 10/18
The implementation of the Stack ADT in myStack.java is static in
the sense that it expects the user the know ahead of time what the maximum size of the stack should be.
Make the implementation dynamic by "resizing" the stack on an as-needed basis.
Specifically, make the following changes to myStack.java:
- Add a default constructor (no argument) that creates a stack of size 1.
- Add a private resize method that doubles the size of the array.
Use the following function header: void resize().
You have seen examples of resizing in several previously constructed classes, for example, in
- Modify the push method in myStack.java
to check before pushing a new item, if the stack is full; if so, the stack should be resized and then push should be