CS 210 Homework #3 Assignment: constuct and test stack and queue capabilities, using the StringTokenizer Pieces you'll need: a. ST2.java, a revised version of ST.java from last week. This is a bit easier to use as a utility. It provides a class Tokenizer which does the setup, and provides method getNext() which returns an object of type Token. (class Token is also provided. Note that Token has a toString() method, which allows you to send it to System.out.println.) ST2 has a main program, which you'll want to modify or replace. b. StackX.java, a revised version of the code from Lafore (see Chap04/Stack) I have modified it to use Object instead of long, and added a display method. I also removed the main function, but you can keep it if you'd feel better about testing StackX by itself, rather than via ST2. c. Queue.java, which you should get from Lafore (Chap04/Queue). You get to make the above changes to this one .. probably create a file Queue.java, change it to use Object instead of long, add a display method. Things to be done: 0. Pick up the pieces and understand how they work. Each can be compiled and run as it arrives. Do that before you start making changes! Add println statements or use DrJava breakpoints if you need to see more closely what's going on. DO THIS IN LAB esp if you have a Monday Lab! 1. Make a program to read tokens and, on command, push them on the stack, or pop them from the stack. This will be built out of (a) and (b), above. - create a new stack of size, say, 10. - if the token is "+", then push the PREVIOUS token onto the stack (and print out what you've done) - if the token is "-", the pop a token from the stack (and print it out) - if the token is "=", then display the stack. 2. Plug some loose ends. If the stack is empty, pop should print an error message (and return null) rather than crashing. Push should do the same if the stack is full. 3. Now do the same as (1), but using a queue instead of a stack. Make sure your testing includes the case where the queue wraps around. 4. Similar to (2) for queues. Also, if you've not done so already, make the display method show the queue in order, from front to back, including the array subscript as in StackX. Thus something like q[3]: 111 q[4]: 222 q[0]: 333 Next week, we'll make (2) into a Polish-postfix calculator.