Question: using python Q4. Define a class callged Polygon.This class has data attributes to store the number of sides 'n' and magnitude of each side as
using python
Q4. Define a class callged Polygon.This class has data attributes to store the number of sides 'n' and magnitude of each side as a list called 'sides'. For class Polygin: The inputSides() method takes in the magnitude of each side The dispSides() method displays these side lengths
Class Triangle: Create a class called Triangle which inherits from Polygon. This makes all the attributes of Polygon class available to the Triangle class. However, the Triangle class has a new method findArea() to find and print the area of the triangle.
Create an object for triangle and call inputSides, dispSides and findArea
Hint: Assume a, b, c are the side lenghts of a triangle s = (a + b + c) / 2 area = (s(s-a)(s-b)*(s-c)) ^ 0.5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
