Find each rectangle in the drawing, and estimate a value for its (X,Y) upper left corner, width, and height.

A good answer might be:

You should get something like this:

  1. House --- ( 65, 100) width=110, height=110
  2. Door --- (120, 165) width= 25, height= 40
  3. Left Window --- ( 90, 115) width= 30, height= 30
  4. Right Window --- (130, 115) width= 30, height= 30
  5. Tree Trunk --- (255, 100) width= 10, height=100

Start on the Applet

With this information, we can start working with the Etch-a-sketch,... err, I mean applet. Here is a start to the applet.

import java.applet.Applet;
import java.awt.*;

// assume that the drawing area is 350 by 250
public class tenCircles extends Applet
{
  final int width = 350, height = 250;
  final int houseX = ________, houseY = ______, houseW = _______, houseH = ______ ;
  final int doorX  = ________, doorY  = ______, doorW  = _______, doorH  = ______ ;
  final int lWindX = ________, lWindY = ______, lWindW = _______, lWindH = ______ ;
  final int rWindX = ________, rWindY = ______, rWindW = _______, rWindH = ______ ;
  final int trunkX = ________, trunkY = ______, trunkW = _______, trunkH = ______ ;
  
  public void paint ( Graphics gr )
  { 

     gr.drawRect(                                  ); // house
     gr.drawRect(                                  ); // door
     gr.drawRect(                                  ); // lwind
     gr.drawRect(                                  ); // rwind
     gr.drawRect(                                  ); // trunk
  }
}

You may think that it would be just as easy to put the numbers directly in the various called to the drawRect() method, but this is not so. If you need to adjust things later on, it will be very useful to have names for the various values you wish to change.

QUESTION 4:

Fill in the 40 (!) blanks.

Click Here after you have answered the question