Using the drawing tools presented here, draw a house-just go for the simple child's house with one door, two windows, walls, and a roof.

What will be an ideal response?


```
public void drawHouse ( int x , int y ,
int houseWidth ,
int houseHeight )
{
int doorWidth = houseWidth / 4 ;
// draw the r i g h t window
g . f i l lRe c t ( x + ( int ) ( houseWidth ¤ 3 / 4 ) ,
y ¡ ( int ) ( houseHeight ¤ 3/ 4 ) ,
windowWidth , windowWidth ) ;
// draw the r o o f
g . s e tCo l o r ( Color .BLACK) ;
int [ ] xArray = fx , x+houseWidth / 2 , x+houseWidth g ;
int [ ] yArray = fy¡houseHeight ,
y¡( int ) ( houseHeight ¤ 1 . 5 ) , y¡houseHeight g ;
g . f i l lPo l y g o n ( xArray , yArray , 3 ) ;
g
int doorHeight = ( int ) ( doorWidth ¤ 1 . 5 ) ;
int windowWidth = houseWidth / 8 ;
// g e t the g r a p h i c s o b j e c t
Graphics g = this . ge tGraphi c s ( ) ;
// draw the bot tom square
g . s e tCo l o r ( Color .GREEN) ;
g . f i l lRe c t (x , y¡houseHeight , houseWidth , houseHeight ) ;
// draw the door
g . s e tCo l o r ( Color .BLACK) ;
g . f i l lRe c t ( x+((houseWidth / 2) ¡ ( doorWidth / 2 ) ) ,
y¡doorHeight , doorWidth , doorHeight ) ;
// draw the l e f t window
g . s e tCo l o r ( Color .WHITE) ;
g . f i l lRe c t ( x+windowWidth ,
y¡( int ) ( houseHeight ¤ 3 / 4 ) ,
windowWidth , windowWidth ) ;
}
```

Computer Science & Information Technology

You might also like to view...

The __________ operator returns a reference to a __________ object:

a. typeid, type_info b. typeinfo, type_id c. typeid, data_type d. typeinfo, type

Computer Science & Information Technology

The drive designator, folder name, subfolder names, and filename is called the ____________________, or location of the open file in relation to any folders in the website.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

From top to bottom, list the 7 layers of the OSI model.

What will be an ideal response?

Computer Science & Information Technology

A self- ________ class is used to form dynamic data structures that can grow and shrink at execution time.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology