Comp 272 Program 3 Dordal Due: Nov 15, 2002 (end of week 12) 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. * Add a ColoredShape shape, derived from Shape, which consists of one (arbitrary) shape, and a color. ColoredShape::plot() draws the` shape in the given color, and then restores the previous 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 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 (and setup.h) to get shapes.cpp to compile. Do *not* change these auxiliary files; I will expect your program to compile with the versions of setup.h and 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. 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 will have one new operation: add(Shape * s). You'll implement this with _shapelist.push_back(s); _shapelist will thus be initially empty. 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 calls facedraw(). Delete that call from your program.