In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

In an n-sided regular polygon, all sides have the same length and all angles have the same degree (i.e., the polygon is

Post by answerhappygod »

In an n-sided regular polygon, all sides have the same
length and all angles have the same degree (i.e., the polygon is
both equilateral and equiangular).
Design a def named RegularPolygon that
contains:
■ An int data field named n that defines the number of
sides in the polygon with default value 3.
■ A float data field named side that stores the length
of the side with default value 1.
■ A float data field named x that defines the
x-coordinate of the polygon’s center with default value
0.
■ A float data field named y that defines the
y-coordinate of the polygon’s center with default value
0.
■ A no-arg constructor
that creates a regular polygon with default values.
■ A constructor that creates a regular polygon with the
specified number of sides and length
of side, centered at (0, 0).
■ A constructor that creates a regular polygon with the
specified number of sides, length of
side, and x-and y-coordinates.
■ The method
getPerimeter() that returns the perimeter
of the polygon.
■ The method getArea()
that returns the area of the polygon. The formula for computing the
area of a regular polygon is Area =
(n*s^2)/(4*tan(pi/n))
In the form below
In An N Sided Regular Polygon All Sides Have The Same Length And All Angles Have The Same Degree I E The Polygon Is 1
In An N Sided Regular Polygon All Sides Have The Same Length And All Angles Have The Same Degree I E The Polygon Is 1 (46.72 KiB) Viewed 32 times
import numpy as np def RegularPolygon() : def RegularPolygon2(number,newSide): def RegularPolygon3(number, newSide, newX, newY): def getPerimeter(n,side): def getArea(n,side): r1=RegularPolygon(); r2=RegularPolygon2(6, 4); r3=RegularPolygon3(10, 4, 5.6, 7.8);
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply