The document defines a Polygon abstract base class and three subclasses - Triangle, Quadrilateral, and Pentagon. Polygon initializes with side lengths and number of sides. The subclasses override the perimeter and area methods to calculate these values specific to each shape type. Examples are provided to create objects of each subclass and print their perimeter and area.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
22 views2 pages
Polygon
The document defines a Polygon abstract base class and three subclasses - Triangle, Quadrilateral, and Pentagon. Polygon initializes with side lengths and number of sides. The subclasses override the perimeter and area methods to calculate these values specific to each shape type. Examples are provided to create objects of each subclass and print their perimeter and area.