CSC 241- Assignment 2


This is the first time that you are developing an applet that will utilize packaged classes (For assignment #1, all classes and the applet were in the same directory and not packaged). It is critical to specify the codebase and code parameters in the applet tag of the html file correctly. It is also important that your .class files are all public. An applet that you have developed may run fine for you, but it is possible that no one, or most importantly, I can't run it. The CLASSPATH statement in your .cshrc file provides you access to your own files, even when you have forgotten to make them public. A more weird occurance is when one of your classmates runs your applet and it acts slightly differently, this one happens because when he/she is running your applet, Java is using one or more of his/her .class files. This is not unusual as you all have a Tank class and a displayableTank class that are used here and your directory structures are the same for this course.

In summary, an applet is not "working" unless I can run it. The following three things should be checked before submitting any applet:

  1. The codebase and code parameters in the .html file are correct.
  2. All classes are packaged correctly, including the applet.
  3. All necessary .class files are public.

Part 1 -- Changeable Tank + test Applet (Due February 27 1998)

Design the class changeableTank which is a subclass of class displayableTank. changeableTank.java and changeableTank.class need to be in your Tank directory. You should use the "original" tank class for this program, so copy your Tank.java file inot Tank.bak and recopy my version of the Tank class and compile it. changeableTank class must be packaged the same way as displayableTank. Make sure that all .class files are public. Here are the specs:

Build an applet that demonstrates that it works, have the applet work like my Changeable Tank Applet . Your applet should be placed in a new directory (Applets) off of your csc241 directory. Its package name should be csc241.Applets, once you compile it, make the .class file public.

Save the .html file for my version in your Applets directory also. The codebase and code parameters need to change. There should be no .cs in your codebase, and of course, the user name has be changed. There should be no .samples in your code parameter and the name of the .class file should be what you named your applet. Make the .html file public, and link to it from your csc241 page.

Mail me the appropriate files.


Part 2 -- Tank Stack Applet (Due March 19th 1998)

You will build an applet that maintains a stack of tanks. Check my Tank Stack Applet to see how your applet should work. In general, write with safety in mind. A tank object should not be manipulated if null. The same things holds true for and stack object, or other object. If nullpointerExceptions are generated when you run the applet with appletviewer, you should pay attention to them and correct the problem. Again, what I said as important for part1 for making your applet accessible to me holds here. The .class file for genStack and the path to it seems to get forgotten easyly (hint).

mail me the .java file and keep a link to the html file for this applet in your csc241 page.