Question: (in java program) Exercise V. Polygon Write the class Polygon to represent polygons of equal sides, that has the following methods: Polygon(n,s) constructor where n
(in java program)
Exercise V. Polygon Write the class Polygon to represent polygons of equal sides, that has the following methods: Polygon(n,s) constructor where n is the number of sides the polygon has and s is the length of each side. perimeter() that returns the perimeter of the n-sided polygon. area() returns the area of the polygon. (Note: area of a polygon is 4tan () Page 4 CMPS 212 Labos Spring 2020/2021 Then implement the classes Square and Triangle that extend Polygon. You need to overwrite the constructor so it only takes one parameter, the side length. Also, overwrite the area() method to implement a simpler calculation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
