A polygon is a closed figure with three or more sides. A regular polygon has sides that are all equal. Imagine that you have a circle of radius r, and you draw a regular polygon within the circle so...






A polygon is a closed figure with three or more sides. A regular polygon has sides that are all equal. Imagine that you have a circle of radius r, and you draw a regular polygon within the circle so that the polygon’s corners just touch the circumference of the circle. For example, you might draw







If the polygon has n sides, you can use the following expression to compute the sum of its sides—that is, its perimeter:



Because the angle, 360 / n, in the previous expression is given in degrees, and the method Math.cos requires radians, you must convert from degrees to radians by using the formula


radians = degrees x π / 180


Design and implement a class of regular polygons. An object of this class should be able to report its number of sides and its perimeter. Demonstrate your class by writing a suitable program.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here