1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gnesinka [82]
4 years ago
15

A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e.,the

polygon is both equilateral and equiangular). The formula for computing the area of a regular polygon is:
Area = (n * s²) / (4 * tan(π/n))
Write a method that returns the area of a regular polygon using the following header:
public static double area(int n, double side)
Write a main method that prompts the user to enter the number of sides and the side of a regular polygon and displays its area.
Computers and Technology
1 answer:
butalik [34]4 years ago
4 0

import java.util.Scanner;

public class polygon {

/** Main Method */

public static void main(String[] args) {

 Scanner input = new Scanner(System.in); // Create a Scanner

 // Prompt the user to enter the number of sides  

 // and the side of a regular polygon

 System.out.print("Enter the number of sides: ");

 int n = input.nextInt();

 System.out.print("Enter the side: ");

 double side = input.nextDouble();

 // Display the area of the regular polygon

 System.out.println("The area of the polygon is " + area(n, side));

}

/** Method area computes and returns the area of a regular polygon */

public static double area(int n, double side) {

 return (n * Math.pow(side, 2) / (4 * Math.tan(Math.PI / n)));

}

}

You might be interested in
An experimenter discovers that the time for people to detect a string of letters on a computer screen is 400 milliseconds, and t
nadya68 [22]

Answer:

The correct answer to the following question will be Option D (Subtractive method ).

Explanation:

  • This approach essentially requests a participant to construct two activities that are already in almost every way similar, except for a mental process that is assumed to also be included in any of the activities although omitted in another.
  • This method will be much more valuable when deciding the period for phonemic awareness, despite text-string identification.

The other three options are not related to the given scenario. So that Option D is the right answer.

3 0
3 years ago
How is the United Kingdom planning to use driverless cars beginning in 2015?
AlekseyPX
You need answers to the question

8 0
3 years ago
Read 2 more answers
Two electronics technicians are discussing electrical quantities. Technician A says that resistance is an opposition to electric
inessss [21]
Neither are correct.

Resistance is opposition to CURRENT not power.
Technition B Is wrong about the voltage thingy.
6 0
3 years ago
Does anyone know how I can make this return a double with 2 decimal places?
dolphi86 [110]

hi :)   .,..............

Explanation:

8 0
3 years ago
Which of these best describes cloud computing? A. an on-demand service that helps to access shared computing and storage resourc
Basile [38]
I think its A. an on-demand service that helps to access shared computing and storage resources from anywhere using an Internet connection
5 0
3 years ago
Other questions:
  • Failure to verify information can lead to?
    10·1 answer
  • One purpose of the dual ignition system on an aircraft engine is to provide for?
    7·2 answers
  • What do the letters of the su command stand for? what can you do with su besides give yourself root privileges? "what can you do
    5·1 answer
  • How can a user view the options for Junk E-mail?
    11·2 answers
  • I don't understand how to write code for this in Java using nested for loops only. The official question is: write a program tha
    8·1 answer
  • What disese is sue suffering from
    15·2 answers
  • Which route of entry could chemicals use to enter through the body’s airways?
    8·1 answer
  • Which device is responsible for converting the main electric supply into usable voltage levels inside a computer?
    12·2 answers
  • Which processor family is most likely found on recent gaming laptops (Gaming laptops require a lot of computational power)?
    11·1 answer
  • The field of ____ is concerned with the technical issues involved in information display. computer science
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!