Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Iminutinm A square sha ed can be considered to be a specific the of a rectangle. This is a mationthip wo can is -

Iminutinm
A square sha ed can be considered to be a specific the of a rectangle. This is a mationthip wo can "is-a", where a square "is-a" specific type of rectangle, particulariy Whent all 4 sides are equal. in ?OOP this relationship is called Inheritance.
The same idea we can follow for a circle. which "ls-a" specific type of an oval.
We can aloo generalite where we can say all circles, ovals, squares and rectangles are Gifiereat kypets of shapes.
Hence, shape is a generaf class. But can you draw a shape without knowing what specific shuoe you want to draw? thus a shage is what we call in OOP an abstract class - that is a class that cannot be instantiated.
However, in the spirit of programming in zoneral; we want to create a shape factory Where we can generate random shapes (with valid dimensions, Le. no negative or zero sides or radius, and keep max dirrension to 100, all integers):
Furthermore, adding one twist. If we have a canvas object, one can say that the canvas contains shapes or "has-a" ist of shapes associated with it. This is a composition association in COP, where a canvas contains, or Thas-a" shapc(s).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions

Question

10. Microsoft Corporation

Answered: 1 week ago

Question

4. EMC Corporation

Answered: 1 week ago