All you have to do is copy the information to the blanks.
Here is the applet with all the blanks filled in. With skillful use of the text editor, much of this filling in is fairly easily done using "copy" and "paste."
import java.applet.Applet; import java.awt.*; // assume that the drawing area is 350 by 250 public class HouseRectangles extends Applet { final int width = 350, height = 250; final int houseX = 65, houseY = 100, houseW = 110, houseH = 110 ; final int doorX = 120, doorY = 165, doorW = 25, doorH = 40 ; final int lWindX = 90, lWindY = 115, lWindW = 30, lWindH = 30 ; final int rWindX = 130, rWindY = 115, rWindW = 30, rWindH = 30 ; final int trunkX = 255, trunkY = 100, trunkW = 10, trunkH = 100 ; public void paint ( Graphics gr ) { gr.setColor( Color.orange ); // there is no Color brown gr.drawRect( houseX , houseY , houseW, houseH); // house gr.drawRect( doorX , doorY , doorW , doorH ); // door gr.drawRect( lWindX , lWindY , lWindW, lWindH); // lwind gr.drawRect( rWindX , rWindY , rWindW, rWindH); // rwind gr.fillRect( trunkX , trunkY , trunkW, trunkH); // trunk } }
Here is the beautiful picture that it produces:
The tree trunk is a solid rectangle because the method fillRect()
was used.
This method is just like drawRect()
except that it fills
in the figure with the current color.
The door is not really where we want it.
We could go back to the graph paper and be more careful this time,
or use the easy method.