Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

option 1 Closs s0 points Question #2 Geometry: a-sided regular polygon) An n-aided regular polygon has n aides of the same length and Gla angies

image text in transcribed
option 1 Closs s0 points Question #2 Geometry: a-sided regular polygon) An n-aided regular polygon has n aides of the same length and Gla angies have the same degree ti.e.. the polygon is both oquilateral and equiangular). Deaign a class named that containar * A private data field nated that defines the number otidea in the polygon with default value A private double data field naned side that storea the length of the side with detault value 1 . A private le data field naned that detines the x-coordinate of the center of the pol ygon with default value peivate double data field naned y that def ines the y-coordinate of the center ot the polygorn with default value . A no-arg conatructor that creates a regular polygon with default values. A Aconstructorthat createa a regular polygon with the specified naber of sides and the length of side, and centered at . - A contctor that ereates a regular polygon with the specified number of sides, the length of side. and x-and y-coordinates The accessor and mutator methoda for all data fields . The method getperintertl that returns the perimeter of the polygon. The perimeter is the addition of the length of all the aidea of the polygon. The method getAreall that returns the area of the polygon. The formula tor computing the area of a regular polygon is Area= Use the Math. tan (double) method which also returnsa 4tan( ) double. Question 82 25 points Create a teating class which will create two BeqularPolygon objects and it the tvo objects are the isplay then display a nessage stating both objecta contain the same informati ects are not the on rrom ther wecors object Do not assign the objects. You need to copy all the intormation from second object into the tlrst You will need to create two more methods in the Regularpolygon elass: equals checks if the information of two objects are the same copy -copies the information of one object into another Question 83 25 point create a teating glass which will create 5 Regularpolygon objects. Set the side with a random number from 2 to 10 and set p with a randon number from 3 to 8 Display the tollowing for each polygon: . 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

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_2

Step: 3

blur-text-image_3

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

=+What is the procedure for labor relations in the workplace?

Answered: 1 week ago

Question

=+ Are ballots compulsory?

Answered: 1 week ago