CSC 241- Assignment 2



Part 1 -- Changeable Tank + test Applet (Due March 1, 2000)

Design the class changeableTank which is a subclass of class displayTank. changeableTank.java should be in your Tank directory. changeableTank inherits all fields and methods of displayTank as well as Tank itself. Here are the elements that are needed in changeableTank:

Build an applet that demonstrates that it works, have the applet work like my Changeable Tank Applet , here is a snapshot of what it looks like in a browser. Develop your applet in the Tank directory as well. Save the .html file for my version (changeableTankApplet.html) in your Tank directory.

Your applet here is very much like Tank Applet except for the fact that it tests the functionality of changableTank by adding a couple buttons that either change the coordinates of the Tank, or change its size.

Mail me your changableTank.java and changeableTankApplet.java. Add a link to your 241.html page as well.


Part 2 -- Tank Queue Applet (Due March 8, 2000)

Part 2-1

Turn all .java files in your Tank directory into members of package csc241.Tank:

  1. you will need package csc241.Tank; added to the top of every .java involved in the Tank directory. (Tank.java, displayTank.java, changeableTank.java, and changeableTankApplet.java)
  2. Recompile everything in the Tank directory with
    javac Tank.java
    javac displayTank.java
    javac changeableTank.java
    javac changeableTankApplet.java
  3. change the changeableTankApplet.html file by replacing the applet tag in it with the following:
    
              <applet 
              codebase="http://www.oswego.edu/~your_user_name/classes" 
              code="csc241.Tank.changeableTankApplet.class" 
              width=800 
              height=500 
              >
              </applet>
    
  4. proceed if you can still load your changeableTankApplet.

Part 2-2

You will build an applet that maintains a queue of tanks. Check my Tank Queue Applet to see how your applet should work. In general, write with safety in mind. A tank object should not be manipulated if the variable referencing it is null. The same things holds true for a queue object, or any other objects. If nullpointerExceptions are generated when you run the applet with appletviewer, you should pay attention to them and correct the problem.

What to Turn In

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