Question
The first method has this EXACT header: public static double computeArea(int n, double s) Given n and s, it will return the area. I am
The first method has this EXACT header: public static double computeArea(int n, double s) Given n and s, it will return the area.
I am unsure of where to put this method in the code below. (This is JAVA programming)
package Homework;
import java.util.Scanner;
public class Assign02_2 {
public static void main(String [] args)
{ Scanner input = new Scanner (System.in);
System.out.print("Enter the number of sides: ");
int sides=input.nextInt();
if(sides<3) {System.out.println("ERROR"); }
else{ System.out.print("Enter the length of the side: ");
double length=input.nextDouble();
double area=(sides*Math.pow(length, 2)/(4*Math.tan(Math.PI/sides)));
System.out.println("The area of the polygon is: "+area); } }}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started