Question: A polygon is a shape with multiple sides. Polygon can be of different types: Triangle is the three- sided polygon. Rectangle is a

A polygon is a shape with multiple sides. Polygon can be of different types: • Triangle is the three- sided polygon. • Rectangle is a four-sided figure. • Pentagon has five-sides • Hexagon has six- sides. Create in Python the parent class (superclass) and subclasses to represent the given problem.
To practice function overloading, overload the calculateArea() function for each of the sub class and calculate area based on the following formulas. You will need to import math to use the square root function math.sqrt().
o Area of a Triangle = (base *height)/0.5
o Area of a Rectangle =(base*height)
o Area of a Pentagon= ((base *height)/0.5) 10
o Area of a Hexagon= ((6 * base * height) + (3 * math.sqrt(3) * base * base))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!