COMP 110-001: Introduction to Programming, SSI'15

Lab 3

25 points

Assigned: Wednesday, May 20, 2015
Due: Friday, May 22, 2015 by 11:59pm (EDT)

Description

Lab 3 will introduce you to Java applets, flow charts, and if-else statements. You have been given a skeleton program SmileyFace.java that can be found on the course webpage. Copy the program into Eclipse, and compile and run the program. When you run the program you will have to input a String before you will see the Java applet appear. (You will use this input for part 2)

Part 1

At the beginning of the program you will notice that there are many Named Constants. Notice that the identifiers are in ALL_CAPS. Go ahead and change the values of some of the Named Constants and recompile to see what changes you have made to the program. Make sure to change the constants back to their original values before continuing to part 2.

Part 2

For this part of the lab you will modify the code SmileyFace.java so that is follows the flow chart.

The flow chart may look daunting so take it one branch at a time. Take a look at the code that has been given to you and pay attention to the comments about where you should start to write your code. You do not need to change any part before or after the comments. The code that reads in the user input (as a String) has been already provided, so what you need to do is to write the multibranch if/else statements. Also, the variables you will play with are mouthStartAngle, noseDiameter, and eyeColor. Do not worry about error checking. If the user inputs the incorrect thing, the original smiley will display without any changes.

Start to play with changing the MOUTH because it is the easiest one.

Grading

How to hand in the assignment