Lab 5 Post-Lab Assignment: Drawing Random Hats

Due Monday, October 11, 2004

Write a RandomHat class that creates a graphical hat object (a top hat formed by a rectangle and a line for the brim) with random size, position, and color. The class should store the following information as instance variables: Your RandomHat class should provide the following methods:

When your RandomHat class compiles, write an applet DrawHats that uses your RandomHat class to create and draw 5 hats. Of course, you also need an html file so you can run the applet. In the html file make the applet width 600 and height 400.

Be sure your program is appropriately documented.

Hand-in: