Building on methods

The output of the HouseDemo applet.

 

As an example of methods using other methods, let us create a method which draws a simple house cross-section. We will choose the parameters to be:

All our houses will have similar proportions - the roof height will be half the wall height.

We will use drawRect from the Java library, and use our own drawTriangle.

Hosted by www.Geocities.ws

1