package samplecode; import edu.byu.phun2d.*; import java.util.*; public class CustomizedFace { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); Win2D win = new Win2D("Customized Face", 160,10,300,300); Group face = new Group(); win.add(face); // add the empty face to the window to be drawn. Oval head = new Oval(0,0,15,15); face.add(head); // add the head to the face. Color pink = new Color(1,0.7,0.7); head.setFillColor(pink); head.setLineColor(null); Oval leftEye = new Oval(-3,2,2,3); face.add(leftEye); // add the new eye to the face. leftEye.setFillColor(Color.BROWN); leftEye.setLineColor(null); Oval rightEye = new Oval(3,2,2,3); face.add(rightEye); rightEye.setFillColor(Color.BROWN); rightEye.setLineColor(null); Oval mouth; System.out.print("What kind of mouth do you want? (wide or round)"); String mouthType = keyboard.next(); if (mouthType.equals("wide")) mouth = new Oval(0,-4,5,2); else mouth = new Oval(0,-4,2,3); face.add(mouth); mouth.setFillColor(Color.RED); System.out.print("Do you want lip liner? (yes or no)"); String yesNo= keyboard.next(); if (yesNo.equals("yes")) { mouth.setLineColor(new Color(0.3,0,0)); mouth.setLineWidth(0.4); } else mouth.setLineColor(null); win.add(new Axes()); } }