in an n-sided regular polygon all sides have the same
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 class named regularpolygon that contains:■ a private int data field named n that defines the number of sides in the polygon with default value 3.■ a private double data field named side that stores the length of the side with default value 1.■ a private double data field named x that defines the x-coordinate of the center of the polygon with default value 0.■ a private 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 length of e, 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 accessor and mutator methods for all data fields.■ 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 isarea = n x s2/4 x tan(p/n)draw the uml diagram for the class. implement the class. write a test program that creates three regularpolygon objects, created using the no-arg constructor, using regularpolygon(6, 4), and using regularpolygon(10, 4, 5.6, 7.8). for each object, display its perimeter and area.
Price Type: Negotiable
Total Proposals: 5
1 Current viewersl
12 Total views
Proposals Reputation Price offered
- 60 Jobs 32 Reviews $0 in 0 Day