Question: in c + + A geometric modeling program defines an abstract base class called Shape that models a generic shape. Sub - classes of this

in c++ A geometric modeling program defines an abstract base class called Shape that models a generic shape. Sub-classes of this class are concrete implementations of specific shapes. For example, you would have a Square class, Circle class, and so on.
Shapes use formatter classes to render shapes on output devices. The system currently has two of these classes:
class Screen def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x,y,radius) end end class Printer def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x,y,radius) end end
Draw a UML diagram that documents the current design. Modify this design so that one can add new shapes and new output formats independently of each other. Document your new design.
Implement a prototype (Id suggest in Python but use your programming language of choice) that demonstrates how you can add a Polygon and XMLForamatter classes to your design.
Note that you dont need to do any sort of fancy output in your prototype. Just add print statements that state what each command would do on an actual device.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!