Bill Teter
Office:          149 Redcay
Telephone:    2782
Office Hours:  Tuesday, Thursday 9:00-12:00

email:  william.teter@plattsburgh.edu

       

 

Lab 11 --Stack and balancing parentheses

In this lab you will create a Stack<AT> class that implements the Interface for stacks on page 226 of the text.  Then, you will use this Stack class to test strings for balanced parentheses.  Call your test program Test.java.  Your test program should expect one command line argument that names a text file.  The text file will contain only the following characters: {,},(,),[, and ].  Your program will echo the string being processed and then print either "the parentheses are balanced" or "the parentheses are not balanced".  Use the algorithm described on page 226.

Step 1. Create a directory called lab11.

Step 2. Write the Stack<AT> interface.

Step 3.  Write the Stack<AT> class that implements Stack<AT> Interface by extending the ArrayList<AT> class from java.util.

Step 4.  Write and test the parentheses balancing program.