import draw.*; import colors.*; import geometry.*; // an example of the use of the drawing methods in the 'draw' library class Examples{ Examples(){} // draw a blue eye with a white pupil at the location (x, y) // on the given Canvas boolean drawEye(int x, int y, Canvas c){ return c.drawDisk(new Posn(x, y), 5, new Blue()) && c.drawDisk(new Posn(x + 2, y), 2, new White()); } // draw a red mouth on the given Canvas (100 by 100) // assume the face will be yellow disk of radius 40 boolean drawMouth(Canvas c){ return c.drawDisk(new Posn(50, 60), 20, new Red()) && c.drawDisk(new Posn(50, 50), 20, new Yellow()); } // draw the nose as a line top to left then straight right // on the given Canvas boolean drawNose(Canvas c){ return c.drawLine(new Posn(50, 40), new Posn(40, 60), new Black()) && c.drawLine(new Posn(40, 60), new Posn(50, 60), new Black()); } // draw the face on a green background on the given Canvas boolean drawFace(Canvas c){ return c.drawRect(new Posn(0, 0), 100, 100, new Green()) && c.drawDisk(new Posn(50, 50), 40, new Yellow()) && this.drawMouth(c) && this.drawNose(c) && this.drawEye(35, 35, c) && this.drawEye(65, 35, c); } Canvas c = new Canvas(100, 100); boolean showFace = this.c.show() && this.drawFace(this.c); }