Description
Lab 5 will revisit the happy smiley face in lab 3, but this time we will write a Class with instance variables and methods for smiley face. You have been given a skeleton program SmileyClass.java for the class, which can be found on the course webpage. To run the program you also need a main file SmileyMain.java to call the methods provided by the class. Copy both programs into Eclipse (create a new Java Project named Lab5 with two Java Class files - one for SmileyClas.java, and the other for SmileyMain.java). When you have SmileyMain.java selected in Eclipse, you can run the program, because it is the starting point to execute the program just as the main method in a Java application.
You have been given the class SmileyClass.java with empty methods. You will need to write the code to fill in the empty methods based on the code you wrote in lab 3. Your methods should perform the actions described in the comments above each method. You have been given the completed method drawFace which will draw the base circle of the face, and the method draw which calls other methods to draw a smiley face with mouth, nose, and eyes.
You should start by adding the drawing features to the draw methods by finding the corresponding code in lab 3 and pasting the correct code into the correct method. Once you have added the drawing code you should be able to run the program and draw the basic smiley face.
We want to provide options to the users, so that, they can control the appearance of a smiley face (by using JOptionPane). Slightly different from Lab 3, you first ask the user to set the color of the eyes (pick among three colors), then ask the user to set the size of the nose, and lastly ask if he/she wants the smiley face to smile (the starting angle of a mouth is 180) or frown (the starting angle of a mouth is 0). You will pass the inputs from the user to the variables in the class, SmileyClass, by calling the setting methods in the class, i.e., setEyeColor, setNoseSize, and setMouth. You need to complete these setting methods SmileyClass.java.
Here is an example: Grading
Which color would you like to pick for eyes? (blue, green, or cyan)
green
How big would you like the nose? (1 to 5)"
3
Would you like the smiley face to smile? (true, false)
false
How to hand in the assignment