CS 117 Assignment: Semi-automaticallly-generated skyline


Many complicated movie scenes that you see involve lots of individually generated objects, all assembled together on one screen. A Pixar movie scene of a city (such as in The Incredibles) involves superimposing a number of buildings of different shapes and sizes. For this assignment, you will create a city landscape by drawing a number of buildings of varied sizes.

Create a directory named skyline to store your work, then copy into it the Canvas class from the course directory. Create a class called Building to represent a building in a landscape. Specifically, it should have the following methods:

You should add on your own any private object variables that you need.

Draw your building by doing what you can to make a rectangle look building-like. Add an antenna to the top of the building whose height is proportional to the rest of the building. Add vertical lines running down or across the building, or perhaps add windows. (With the techniques that we have discussed so far, though, your windows will need to scale with the building. We'll eventually talk about techniques which would allow you to have different numbers of windows to scale with the height of the building, but we're not there yet.)

Test your code as you go along. In other words, create another class called Skyline that creates and draws some buildings. As you write methods in Building, test them in Skyline. When you are all done, test your code against the Skyline.java that Dave Musicant has kindly provided us. It uses a few techniques that we haven't talked about yet, but feel free to take a look. If you have built your Building class correctly, this Skyline program should generate an impressive skyline for you to look at.

When you're finished, use hsp to submit your skyline directory. Don't forget to put your name (or names, if you work with a partner) in the comments at the top of the program. Use javadoc comments at the top of your source file and above each method in the Building class. (We will discuss javadoc on Friday in class, but in the meantime, you should read Appendix I of your book.)

Good luck, and have fun. Remember that lab assistants are available in the evenings in CMC 306 to help out if you need it.