Question: Using Ruby: A geometric modeling program defines an abstract base class called Shape that models a generic shape. Sub-classes of this class are concrete implementations

Using Ruby:

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 in Table 2 currently has two of these classes:

Table 2:

Using Ruby: A geometric modeling program defines an abstract base class called

Draw a UML diagram that documents the current design. Modify this design so that one can add new shapes and new output formats independently 2 of each other. Document your new design. Implement a prototype that demonstrates how you can add a Polygon and XMLForamatter classes to your design. Add print statements that state what each command would do on an actual device.

class Screen def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x, y,radius) end class Printer def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x, y,radius) end end class Screen def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x, y,radius) end class Printer def drawLine(x1,y1,x2,y2) end def drawPixel(x,y, color) end def drawCircle(x, y,radius) end end

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 Databases Questions!