<< Return to Lab 8 Page

Lab 8 - Section 1 Test Page

Additional Description

The requirements for this section are as follows:

  1. Use the import statement at the top of the file to import the following class files and folders: java.applet.Applet, java.awt.*, java.awt.event.*, javax.swing.Timer, and java.util.Random.
  2. Include the class header: public class BlankApplet extends Applet implements ActionListener, MouseListener, KeyListener {}
  3. Declare global int array variables cargoX and cargoY with 50 entries each.
  4. Declare global boolean array variable cargoDrawn with 50 entries.
  5. Declare global int array variables asteroidX, asteroidY, asteroidSpeedX and asteroidSpeedY with 10 entries each.
  6. Declare global int variables shipX, shipY, shipSpeedX and shipSpeedY with an initial value of 0 for each.
  7. Declare a global Timer object variable timer.
  8. Declare and initialize a global Random object variable gen. It can be declared using the new key word and the object's constructor method.
  9. Include the following method outlines in the file:
  10. For the "mouseClicked()" method respond by restarting the game. This involves using the "resetWindow()" method and restarting the timer object with "timer.start()".

Code template where you can insert your portion of the code to test it is located here.

Applet Resulting From Correct Code

No test applet for this section.