Fireworks Description of the problem: The Fireworks applet is used to create a fireworks display for the viewer. There is an object to represent a starburst, which contains its center position, size, and size limit. Description of the algorithm: When the user enters the page on which the Fireworks applet is contained, the applet is initialized wth method init. A new thread is created for the applet with method start, and the applet is then run with method run. In run, each starburst is tested to see if it has reached its size limit, and if so, a new starburst is created. The screen is then refreshed using method repaint. When this occurs, method update is called, in which method paint is called. Here, the background is painted to an offscreen buffer. Next, the size of each starburst is expanded using method expand, and the starbursts are drawn to the offscreen buffer using method paint, both of which are contained in the Starburst class. The starburst is painted by drawing each of the dots in the starburst ring one at a time to the offscreen buffer. Finally, the buffer is drawn to the screen using method drawImage. When the user closes the applet, method stop is called to stop the active thread. Classes: Fireworks - Used to implement a fireworks display. Randomly creates a given number of starbursts which is determined by the value of the variable numStarbursts. When a starburst has reached its size limit, Fireworks creates another starburst and indirectly erases the old one by painting over it with the background. Methods: init() - Override java.applet.Applet.init start() - Override java.applet.Applet.start stop() - Override java.applet.Applet.stop run() - Implement java.lang.Runnable.run update() - Override java.awt.Component.update paint() - Override java.awt.Component.paint Starburst - Used to contain a singls Starburst. It contains information about the center position of the starburst, its color, and a size limit. It also holds the current size of the starburst. In addition, it contains methods for manipulating a starburst. Methods: Starburst() - Starburst constructor which accepts the center coordinates of the starburst, the initial distance of the ring from the center, and the maximum distance allowed setColor() - sets the color of the starburst(access method) reachedLimit() - returns true if the distance of the ring from its center has reached the maximum distance expand() - increases the distance of the ring from its center by one paint() - paint the starburst on the offscreen buffer for display References: http://www.npac.syr.edu/projects/tutorials/docs/Sun/java2/docs/api/index.html - Java 2 API specification was consulted for information about Random class in java.util package