Modify the source code for the Stack class from Chapter 17, shown in Displays 17.17 through 17.19.
Fantastic news! We've Found the answer you've been seeking!
Question:
Modify the source code for the Stack class from Chapter 17, shown in Displays 17.17 through 17.19. Currently, if the user of the class attempts to pop from an empty stack the program prints out an error message and exits. Modify the program so that it instead throws an exception named PopEmptyStackException. Write a main function that tests the new Stack class, attempts to pop from an empty stack, and catches the PopEmptyStackException exception.
Related Book For
Cornerstones of Managerial Accounting
ISBN: 978-0324660135
3rd Edition
Authors: Mowen, Hansen, Heitger
Posted Date: