OOAD 2017 old paper Solution

7th semester





Group C

Q.no 8

Step 1

Create an interface.
Shape.java


Step 2

Create concrete classes implementing the same interface.
Rectangle.java

Square.java

Circle.java

Step 3

Create a Factory to generate object of concrete class based on given information.
ShapeFactory.java



Step 4

Use the Factory to get object of concrete class by passing an information such as type.
FactoryPatternDemo.java

Step 5

Verify the output.



Leave a Reply

Your email address will not be published. Required fields are marked *