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]
3 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]3 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
1) Create a recursive program that prompts the user for a nonnegative integer N and outputs. a) Sum [N] b) BiPower [N] c) TimesF
Georgia [21]

Answer:

//Code is created using java

import java.util.*;

// returns the sum

public int sum(int N)

{

if(N==1)

return (1);

else

return N+sum(N-1);

}

// code to return the Bipower ouput

public int BiPower(int N)

{

if(N==1)

return (2);

else

return 2*BiPower(N-1);

}

// Code to return TimesFive output

public int TimesFive(int N)

{

if(N==1)

return 5;

else

return 5 + timesFive(N-1);

}

public static void main(String args[])

   {

//Prompts the user to enter a nonnegative integer

       int N  = Integer.parseInt.(console.readLine("Enter a nonnegative integer:  "));

//Outputs the sum, Bipower and TimesFive

       System.out.println(sum(n));

       System.out.println(BiPower(n));  

       System.out.println(TimesFive(n));

   }

}

4 0
3 years ago
After earning a learners license what test must be successfully passed to earn an operators license in Florida
Monica [59]
After earning a learners license , the <span>test that must be successfully passed to earn an operators license in Florida is: the driving skill test
The diriving skill test is a set of procedure that all learners must follow in order to determine the learners' ability in driving motor vehicle and test learner's understanding about traffic rules.</span>
5 0
3 years ago
An employee sets up an automation that transfers files in a specific folder on their PC to a remote drive for archiving, provide
Yuri [45]

Answer:

Rule based automation

Explanation:

8 0
2 years ago
Which of the following actions is most likely to raise legal or ethical concerns?
zavuch27 [327]

Answer:

arson, kidnapping, gun fighting

Explanation:

7 0
2 years ago
Read 2 more answers
Relieved to have survived ,henry rolled off the rink________.giving alex a grateful look
Marina86 [1]

Answer:

simultaneously might be the answer

8 0
2 years ago
Other questions:
  • Lawanda starts a new job today at a company that delivers thousands of packages each day. Identify three ways in which Lawanda's
    9·1 answer
  • Antivirus software products require that you update _____ on a regular basis
    6·2 answers
  • How much time does a gold chest take to open
    11·1 answer
  • If Nancy receives an encrypted message from Matthew, which key does she use to read it? Nancy’s private key Nancy’s public key M
    8·1 answer
  • Who created the first photograph
    9·2 answers
  • Please help please I will count your answer brainiest if you help!
    8·1 answer
  • List any three importance of computer points​
    8·1 answer
  • I need some help with this assignment. I'm having difficulty trying come up ideas to use here. Can I get any help?
    5·1 answer
  • Identify the calculation performed by the following code.
    7·1 answer
  • I need the full code for 6.1.3 code hs circles and squares please answer please help
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!