CS 140 - HW 2, Due Monday September 7

Part I - Finishing Mr. Blockhead

Finish the picture of Mr. Blockhead yo ustarted in class on Wednesday.

  1. Give Mr. Blockhead a smile. One way to do this is to erase the top half of the oval by writing over it with a shape that is the same color as the background. Figure out which shape(s) to use and where to place it. Be careful not to erase part of his nose.
  2. Make Mr. Blockhead's eyes big and give him pupils.
  3. Give Mr. Blockhead some ears.
  4. Grow some hair on his head. To do this use the drawLine(x1,y1,x2,y2) command.
  5. Across Mr. Blockhead's forhead write the text "Blockhead". To write text onto a picture use the graphics command drawString("Some text",x,y); writes the text Some text at coordinate (x,y) on the picture.

Part II - Drawing a Bullseye

Create a new drawing from scratch that draws a bullseye like below. Put this code after the code for Mr. Blockhead. Make a 700 by 700 picture and give the biggest (outer) circle a diameter of 500. Don't for get to make the crosshairs in the center. Center your bullseye in the canvas.

Turning in your HW

  1. Make sure you have a file named Program.java in a folder named HW2 in your folder on the T: drive.
  2. Make sure you turn in a printout at the start of class on Monday. Don't rely on the printer in the classroom.