Lab Exercise #6
for labs meeting Friday, Feb. 21, 2003
Objectives: The purpose of this lab is to work more with linked
list operations.
Into your csci133 directory, copy and compile programs53/Decode.java.
This is a program from p. 649 of Lewis/Loftus that uses the Stack
class provided by java.util. Examine this program carefully, and
run it to see its behavior.
Now develop your own csci133.Stack class that uses a linked list
to represent a character stack and provides these methods (as described
on p. 648):
boolean empty() Tests if this stack is empty.
char peek() Looks at the character at the top of this stack
without removing it from the stack.
char pop() Removes the character at the top of this stack and
returns that character as the value of this function.
void push(char item) Pushes a character onto the top of this stack.
Then you should be able to modify the import statement in Decode.java
so it imports your stack class instead of the one in the Java libraries.
HINT: It's probably helpful to use MagazineList as an example
of how to set up the linked-list stuff.