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.

PROGRAMING LANGUAGE: java

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:00
Need ! will choose brainliest! discuss the role of abstraction in the history of computer software.
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
What is a programming method that provides for interactive modules to a website?
Answers: 1
question
Computers and Technology, 24.06.2019 02:30
Write the pseudo code for this problem based on what you learned from the video. the purpose is to design a modular program that asks the user to enter a distance in kilometers, and then converts that distance to miles. the conversion formula is as follows: miles = kilometers x 0.6214
Answers: 3
question
Computers and Technology, 24.06.2019 09:30
Retype the statements, correcting the syntax errors. system.out.println("num: " + songnum); system.out.println(int songnum); system.out.println(songnum " songs"); note: these activities may test code with different test values. this activity will perform two tests: the first with songnum = 5, the second with songnum = 9. see how to use zybooks.
Answers: 1
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
History, 08.04.2021 14:00
question
Mathematics, 08.04.2021 14:00
question
Mathematics, 08.04.2021 14:00
question
Mathematics, 08.04.2021 14:00
question
Mathematics, 08.04.2021 14:00
Questions on the website: 13722363