(Geometry: n-sided regular polygon) An n-sided regular polygon has n
sides of the same length and all angles have the same degree (i.e., the
polygon is both equilateral and equiangular). Design a class named
RegularPolygon that contains:
An int data field named n that defines the number of sides in the
polygon with default value 3.
A double data field named side that stores the length of the side with
default value 1.
A double data field named x that defines the x-coordinate of the center
of the polygon with default value 0.
A double data field named y that defines the y-coordinate of the center
of the polygon 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 the length of side, and centered at (0, 0).
A constructor that creates a regular polygon with the specified number
of sides, the length of side, and x-and y-coordinates.
The method getPerimter() that returns the perimeter of the polygon.
The method getArea() that returns the area of the polygon. ThThe formula
for computing the area of a regular polygon is
Area=(n*s^2)/4*tan(pi/n)
How can I find a solution with uml
sides of the same length and all angles have the same degree (i.e., the
polygon is both equilateral and equiangular). Design a class named
RegularPolygon that contains:
An int data field named n that defines the number of sides in the
polygon with default value 3.
A double data field named side that stores the length of the side with
default value 1.
A double data field named x that defines the x-coordinate of the center
of the polygon with default value 0.
A double data field named y that defines the y-coordinate of the center
of the polygon 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 the length of side, and centered at (0, 0).
A constructor that creates a regular polygon with the specified number
of sides, the length of side, and x-and y-coordinates.
The method getPerimter() that returns the perimeter of the polygon.
The method getArea() that returns the area of the polygon. ThThe formula
for computing the area of a regular polygon is
Area=(n*s^2)/4*tan(pi/n)
How can I find a solution with uml