subject
Computers and Technology, 18.11.2020 23:00 Maaarii

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, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 24.06.2019 07:00
You are most likely to automatically encode information about
Answers: 1
question
Computers and Technology, 24.06.2019 13:50
Write a program that performs a simple n-body simulation, called "jumping leprechauns." this simulation involves n leprechauns, numberd 1 to n. it maintains a gold value g_i for each leprechaun i, which begins with each leprechaun starting out with a million dollars worth of gold, that is, g_i = 1000000 for each i = 1,. in addition, the simulation also maintains, for each leprachaun,i, a place on the horizon, which is represented as a double-precision floating point number, x_i. in each iteration of the simulation, the simulation processes the leprachauns in order. processing a leprachaun i during its iteration begins by computing a new place on the horizon for i, which is determined by the assignment:
Answers: 3
question
Computers and Technology, 24.06.2019 15:30
If you want to delete an entire word at a time, which key should you press along with the backspace or delete key?
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
Mathematics, 04.02.2021 20:20
question
Mathematics, 04.02.2021 20:20
question
Engineering, 04.02.2021 20:20
question
Mathematics, 04.02.2021 20:20
Questions on the website: 13722361