logo CodeStepByStep logo

SmileyFace

Language/Type: Java graphics parameters

Write a graphical program named SmileyFace that draws a "smiley face" image as shown. Your program's overall window size should be 300x150 pixels. The face has the following shapes in the following places:

  • overall head: a rectangle with top-left corner at (20, 10), size 100x100
  • left eye: an oval with top-left corner at (40, 30), size 20x20
  • right eye: an oval with top-left corner at (80, 30), size 20x20
  • nose: an oval with top-left corner at (65, 60), size 10x10
  • mouth: three lines: one from (40, 80) to (50, 90); one from (50, 90) to (90, 90); one from (90, 90) to (100, 80)
  • a text label saying "Smile!", located at (20, 140)
expected output
Type your Java solution code here:


This exercise asks for a complete program. This should essentially be contents you could put into a file and run outside of CodeStepByStep.

You must log in before you can solve this problem.

Log In

Need help?

If you do not understand how to solve an exercise or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect tests, etc.), please

Is there a problem? Contact a site administrator.

©, all rights reserved.