Assignment 4 Help

The Provided Files

I have given you the following java files. (Get them here.)

Queue.java and Stack.java
These are Blanca Polo's interfaces from the assignment webpage. You will need to implement these interfaces, but do not change these files.
StackException.java and QueueException.java
Handy pre-written exceptions for you. You do not need to change these (though you may).
Node.java
The Node class from assignment 3, you can reuse this to implement your Queue and Stack. Do not change it. (Note that you are simply using Nodes. You are not implementing or extending any Node classes in this assigment.)
TestStack.java and TestQueue.java
When you are done, these files will test your implementations. Change the class name near the top (it's commented) to whatever you called your implementating class (if you used something other than MyQueue or MyStack).

(The a4files.zip contains all the .java files and this page, for easy downloading.)

"So what do I need to do?"

You need to write 3 files. You may call these files whatever you want.

  1. MyStack.java -- this file implements Stack.java. You will use Node.java to implement the stack, and you will throw StackExceptions from here. When you are done, you can test to see if it works with TestStack.java
  2. MyQueue.java -- this file implements Queue.java. You will use Node.java to implement the queue, and you will throw QueueExceptions from here. When you are done, you can test to see if it works with TestQueue.java
  3. StackQueueApplet.java -- this file will be your applet file. You will use MyStack and MyQueue objects here, calling the methods you implemented. You will have to catch (but not throw) Stack and Queue Exceptions. (Do not use any Nodes in this class.)

Question?

Is something here unclear? Email me or Blanca.

FAQs

What should I turn in?
You only need to send me the 3 .java files you wrote, since there's no need to change any of the other files and I already have those. Also, don't forget a URL to your working applet on the Web and the .html file to run your applet.

  ← Back to Assignment 4