This assignment gives you some practice in basic Java programming by having you code up the smiley faces example weve been discussing in classwith a few additional wrinkles.
In general, you are to write a Java program that draws one, two, or three smiley faces on the screen, each with characteristics you provide, such as the color and the shape of the face itself, and of the eyes and mouth. You also implement methods that translate the smiley as a whole, and that let you scale and translate each of the smileys parts (the face, eyes and mouth).
The SmileyGroup() method contains the code that produces the face(s). We suggest you write various bodies for SmileyGroup() so that you gain experience in using the two smiley face constructors, the set attribute routine, and the translation and scaling routines included in the program, and in drawing one, two and three faces.
Program behavior is straight-forward: when run, a graphics window appears. It should show one, two or three smiley faces, each with a background (face), two eyes that are above an imaginary horizontal line through the center of the face and a mouth that is below that line; the eyes and mouth should have colors that make them distinguishable from the face. Within these parameters, you may make the faces look as you like.
The user clicks on the close box to close the window and stop the program.
For this assignment, weve helped you get started by providing some code and lots of comments in the files that comprise the smiley program. They are stored together in the archive file Lab1.zip. Download Lab1.zip to your computer and unzip it into its own folder. (If you are unfamiliar with unzipping files, ask your TA or tutor for assistance; its quite straight-forward.) Replace all spaces marked // your code goes here with your own Java code so as to have a complete, correctly working program.
After making changes to the program, it is best to use the command javac *.java to ensure all parts of the program are recompiled. (For more on this, see the Orientation to the Lab section of the manual. Run the program with the command java Smiley.
You should always follow good design strategies in your code. We help you do that with this assignment by showing you the classes and methods you should have (and where they should be defined and used). Note especially how heavily we rely on using many classes and methods and how little of the work is done in main(). As the assignments progress, you will be expected to complete more and more of the design yourself.
When writing any program, you should follow a good, consistent coding and documentation style. For assignments and exams for this class, stick with a style similar to Horstmanns. The instructor or your TA may modify Horstmanns style somewhat; if so, follow the class standards. If you deviate from our class style, the course staff could have a harder time understanding your code on the lab exam, as well as when assisting you with the assignment. Remember that a significant failure to follow class style standards on a lab exam can result in a not pass for that exam.
Lab exam #1 will be very similar, but perhaps not identical, to the program you are to code for this exercise.
The lab exam will have you code one or more of the following methods:
Remember to read over the lab exams program comments before beginning; they will tell you what you are to complete and give any particulars (such as, for example, the characteristics of the smiley face(s) you are to draw).