go to previous page   go to home page   go to next page

Answer:


Calculating a Location

These calculations can be plugged into the declaration section:

  final int width  = 350, height = 250;
  
  final int houseX =  50, houseY = 100, houseW = 150, houseH = 100 ;
  final int               doorY  = 150, doorW  =  20, doorH  =  50 ;
  final int lWindX =  75, lWindY = 140, lWindW =  25, lWindH =  40 ;
  final int rWindX = 160, rWindY = 140, rWindW =  25, rWindH =  40 ;
  final int trunkX = 260, trunkY =  65, trunkW =  10, trunkH = 100 ;
  
  final int doorX  = houseX + houseW/2 - doorW/2;    
  

The same sort of calculation could be done with other points in the picture. But let's move on to the tree. Look at the graph paper sketch again (click here to see it) and estimate the location of the upper left corner, the width, and the height of the rectangle that contains the tree's foliage,


QUESTION 6:

Fill in the blanks with values for the rectangle that bounds the tree's foliage.