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:
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 endStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started