Java Assignment 5 -- City Skyline Applet

Click Reload or Refresh to create another skyline

In this assignment you’ll create an applet that randomly generates a city skyline at night. The heights and widths of each building must be selected at random. And, you’ll need to put windows onto the faces of your buildings -- the number and position of all the windows will be random. You’ll need to draw a nighttime sky as a background. The sky has a random number of stars in it, and they’re at random locations. Your city does not need to look like the city shown above. Be creative and have fun! Your program must contain two classes: (1) The public class, called Skyline, that contains the setup and initialization code, the paint method, etc., and (2) An ordinary (non-public) class, called Building, that describes and draws a single building.

The Skyline Class (a public class)

The Building Class (not a public class)

You may put both classes into the same file, Skyline.java, if you wish. Or you may put each class into a separate file, Skyline.java and Building.java. The choice is yours, but make sure you will upload both class files to your website!

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 along with your Java code (the .java file(s)) in an email message to mrsimon@lycos.com.