Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago