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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!