Lab 4. Queue and Stack
CS203, Spring 2006



1. (35pt) Create a CircularArrayQueue class, which implements the Queue interface, using the circular array approach we discussed in class. You may assume that there will be no more than 3 objects in the queue at any time. Note that
2. (15pt)  Modify your CircularArrayQueue class so it dynamically grows like the ArrayList class,  e.g. the size of the array doubles whenever a user tries to enqueue an object to a queue that is already full.

3. (40pt)  Write a program to check whether the symbols '(', ')', '[', ']', '{', and '}' in a given file are balanced. The algorithm uses a Stack and goes like this:
4. (10pt)  Modify the program you developed in the previous exercise so that not only it outputs an error message, it also outputs the line number where the error occurs (or more precisely, where the error is caught).

5. Turn in all the source code files through CSNS.  The total points of this lab is 50. Anything above 50 is considered extra credit.