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:
the bottom left coordinates;
the width;
the height of the walls.
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.