Wednesday, September 28, 2022

WEEK-2

 WEEK-2

Develop an inheritance hierarchy based upon a Polygon class that has abstract methods area () and perimeter (). Implement classes Triangle, Quadrilateral, Pentagon, that extend this base class, with the obvious meanings for the area () and perimeter () methods. Write a simple program that allows users to create polygons of the various types and input their geometric dimensions, and the program then outputs their area and perimeter.

Program:


Output:

No comments:

Post a Comment

WEEK-11

 Write a program to implement Tree Traversal Algorithms  Preorder  Inorder  Postorder Program: Output: