import geometry.*; import draw.*; import colors.*; //14.2 class HouseDrawing { int width; int height; Canvas c; IColor roofColor = new Red(); IColor houseColor = new Blue(); IColor doorColor = new Yellow(); HouseDrawing(int width, int height) { this.width = width; this.height = height; this.c = new Canvas(width, height); } // Draws the House on the Canvas boolean drawHouse() { return this.c.show() && c.drawRect(new Posn(10, 10), this.width-20, this.height-20, this.houseColor) && c.drawLine(new Posn(0, 10), new Posn(this.width/2, 0), this.roofColor) && c.drawLine(new Posn(this.width/2, 0), new Posn(this.width, 10),this.roofColor) && c.drawLine(new Posn(0, 10), new Posn(this.width, 10), this.roofColor) && c.drawRect(new Posn(this.width/2 - 3, this.height-30), 10, 20, this.doorColor); } } class Examples { Examples() {} HouseDrawing house1 = new HouseDrawing(200, 200); boolean draw = house1.drawHouse(); }