Comp 272 Program 3 Dordal Due: Wed, Mar 30, 2005 For your third program you are to take Horstman's shapes.cpp file, available on my web page, and do the following: * Complete the implementation of the Group shape, which basically means getting scale() and clone() to work. * Add a shape class Face, the body of which draws a face along the lines of the way my facedraw() function draws a face. (facedraw() actually draws a couple faces and contains some experiments in moving them; you are to have your Face class draw only one face.) You are, in other words, to change face drawing from a procedure to an object. This is very straightforward; all the data a Face object really needs is a location (in which case plot() would have to create temporary instances of the facial features and draw them); you can also implement Face as containing a Group of the various features. In this latter case the Face ctor creates the feature objects. * Add a ColoredShape shape, derived from Shape, which consists of one (arbitrary) shape, and a color. ColoredShape::plot() sets the current color to the one given, plots the shape (which will thus be in the given color unless for some reason the shape's own plot() method tweaks the colors), and then restores the original color. (Examples of Graphics::getColor() and Graphics::setColor() usage can be found in my shapes.cpp, in the paint() function.) ColoredShape should have its own color() and setcolor() operations. * Get clone() to work for all the shapes. It works for some now; for others it only returns 0. * Define a new class derived from Shape. Provide a ctor. Your shape should be something more complex than a single Polygon. Here are a few possibilities: Tree (oval top, rectangle trunk) wagon (rectangle body, two circular wheels) car (polygonal body, wheels) bird (two polygons, or else one polygon with a circular eye) house (compound polygon) (All these are easily implemented as Groups.) * Draw a simple picture using your shape (and perhaps others), and replicate it all around the screen. Your drawing should include at least two colors, and also some move and scale operations. You will need Horstmann's graphics.cpp and graphics.h to get shapes.cpp to compile. Do *not* change these auxiliary files; I will expect your program to compile with the versions of graphics.* provided on my web page. All your changes should be to shapes.cpp. Note that there is no shapes.h. When you copy these files, you will need to create a new project. I've tweaked Horstmann's graphics.cpp file so that your program should be a "console application". This means that, even though your program draws in a graphics window, you can also write diagnosic/debugging messages to cout. For some reason, this doesn't always work. You are to define/modify the necessary classes, and implement them, and then put all the drawing specifications into the final paint() function. Note that there is no main() function in shapes.cpp (it is in graphics.cpp, and what it does there is to initialize the drawing window.) Group: A Group has within it the following private data: vector _shapelist(); You need to support the operations plot(), move(), scale(), and clone() on Groups. To do these, you just go through the Shapelist and call the respective operation on each individual component. For clone you will first have to create the new _shapelist. You do *not* have to implement working read()/print(). Group has one new operation: add(Shape * s). This is provided for you. There is no delete operation, and no mechanism to access the Nth shape. Note that components can themselves be Groups. Note also that shapes put into a Group will have to be created dynamically: Group g(); g.add(new Star(center, 50)); g.add(new Circle(center, 50)); To get everything to compile, you will also need to provide read() and print() operations; these can be dummies with empty bodies: {} Email me *only* the shapes.cpp file. I've provided it online with a paint() function that contains a bunch of stuff, mostly commented out.