AP Java Assignment 11
An ArrayList of Asteroids

Press '4' to rotate left, '5' to accelerate, '6' to rotate right, '2' for hyperspace
You may need to "click" on the applet to give it the "focus"

Background: ArrayList

An array probably isn't the best way to keep track of a buch of asteroids. Arrays have fixed size. You can't easily add or remove asteroids from an array. A better choice might be an ArrayList. To use an ArrayList we need to import java.util.ArrayList. The ArrayList class has a number of useful member methods:

Steps to completing this assignment

  1. Create a duplicate of your previous assignment by following steps #1 - 6 again, this time calling your class ApJava11.java
  2. Modify your code so that you have an ArrayList of Asteroids.
  3. Now we'll modify the applet so that when our space ship strikes an asteroid, the asteroid is removed from the ArrayList
  4. Everytime an asteroid moves, we'll compare it's x and y coordinates with the x and y coordinates of the space ship.

You will need a web page to display your applet. Your homepage should have a link to the web page for this assignment.

Submit the URL of your applet with the attached Java code (the .java file(s)) in an email message to mrsimon@lycos.com.