|CS 171 & 171L||Introduction to Computer Science I & Lab||Fall 2020|
Homework Assignment 2
Send me (firstname.lastname@example.org) the following in a .java file as an attachment to an email message with Homework 2 as the subject line.
(30 points) Modify your program from Homework 1 so that the user can select several choices for facial features as follows. Adjust your original drawing if needed to demonstrate these additional features.
Define four different mouth styles: smile, flat, frown, round. Allow the user to cycle through these be pressing 'm' on the keyboard.
Define three different eye styles: narrow, normal, wide. Allow the user to cycle through these be pressing 'e' on the keyboard.
Define three different eyebrow styles: up, flat, down. Allow the user to cycle through these be pressing 'b' on the keyboard.
For each of these styles, use global variables to keep track of the current style.
Pressing the s key in the graphics window above will cause the state variable to change. You may need to click on the window before the key press will be recognized. Pressing the s key invokes the keyPressed method. That method increments the state vaiable by 1. Then it it checks the value to see if the value is greater than or equal to 2 and then resets it back to 0 if needed. This will limit the values of state to be either 0 or 1.
You must use comments in your program. At the top, put your name and assignment number in a comment. Label each major section with a comment. Use whitespace (a blank line or two) to also separate section of your code to improve its readability.
Copyright © 2020, David A. Reimann. All rights reserved.