Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java program Alt Ctrl y: n-sided regular polygon) An n-sided regulat polygon has n sides of the same Jength and all angles have the same

image text in transcribed
Java program
Alt Ctrl y: n-sided regular polygon) An n-sided regulat polygon has n sides of the same Jength and all angles have the same degree (i.e., the polygon is both equilateral and equiangular. Design class named RegularPolygon that contains: .A private int data field naned n 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 .A private double data field named y that detines the y-coordinate of the center of the pol ygon .A constructor that creates a regular polygon with the specified number of sides and the length A private double data field named that defines the x-coordinate of the center of the polygon with default value 0. with default value o. A no-arg constructor that creates a regular polygon with default values, of side, and centered at ( 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 for all data fields. The method getPerinterll that returns the perimeter of the polygon, the perimeter addition of the length of all the sides of the polygon. the The method getArea) that returns the area of the polygon. The formula Eor comput ing the area Z . Use the Nath-tan (double) nethod which also returns a of a regular polygon is Area 4tan( )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

13-6 How will MIS help my career?

Answered: 1 week ago