Question: Java: this is all one question Question #1 Geometry: n-sided regular polygon) An n-sided regular polygon has n sides of the same length and all
Question #1 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: 50 points . A private int data field named that defines the number of sides in the polygon with default value 3 . A private double data field naned side that stores the length of the side with default value 1 e A private double data field naned x that defines the x-coordinate of the center of the polygon with default value 0 * A private double data field naned y that defines the y-coordinate of the center of the polygon .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 with default value of side, and centered at (2, . A constructor that creates a regular polygon with the specified number of sides, the length of side, and x-and y-coordinates The accessor and mutator methods tor an data fields. The method getPerimter() that returns the perimeter of the polygon. The perimeter is the addition ot the length of all the sides of the polygon. * The method getAreal) that returns the area of the polygon. The formula for computing the area of a regular polygon is Area , use the Math, tan (double) method which also returns a double 25 points Create a testing class which wil1 create two Regularpolygon objects and if the two objects are the same display then display a message stating both objects contain the same information. If the two objects are not the same then copy all the intormation from the second object into the first one Do not assign the objects. You need to copy all the intormation from second object into the tirst You will need to create two more methods in the RegularPolygon class equals - checks if the information of two objects are the same copy -copies the information of one object into another Question #3 Create a testing class which will create 5 RegularPolygon objects. Set the side with a random number from 2 to 10 and set n with a random number from 3 to 8. Display the following for each polygon 25 points Perimeter . Area . Type of Polygon Type Polygon is based on the number of sides Sides Type Triangle Quadrilateral Pentagon Hexagon Heptagon Octagon
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
