subject

Write code which takes inputs from the user for the number of sides (int) and side length (double), then creates a regular polygon with these characteristics. The program should then print a sentence with the name of the shape and the area and perimeter as shown in the sample run. You should use the appropriate RegularPolygon methods to obtain the perimeter and area of the shape rather than attempting to calculate these values yourself. Sample run:

Enter number of sides:
> 5
Enter side length:
> 3.5
A regular pentagon with side length 3.5 has perimeter 17.5 and area 21.075848157214846
Hint: You can approach this problem by saving the int and double as variables, and then creating the RegularPolygon, or you can create the polygon and use methods to set the values of the sides and sidelength.

To reference the documentation for the RegularPolygon class, click here (Links to an external site.).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
in 2007, floridians died in alcohol-related collisions.a.  501b.  1,051c.  5,015d.  10,839
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Which of the following is not contained on the slide show toolbar? a. next button b. slide button c. close button d. pen tool
Answers: 1
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. andy received a potentially infected email that was advertising products. andy is at risk of which type of security threat? a. spoofing b. sniffing c. spamming d. phishing e. typo-squatting
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
You know the right answer?
Write code which takes inputs from the user for the number of sides (int) and side length (double),...
Questions
question
Mathematics, 15.08.2021 22:30
question
Mathematics, 15.08.2021 22:30
question
History, 15.08.2021 22:30
question
Law, 15.08.2021 22:30
question
Biology, 15.08.2021 22:40
question
Mathematics, 15.08.2021 22:40
question
Mathematics, 15.08.2021 22:40
Questions on the website: 13722362