import java.util.Scanner;
public class Exercise34 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Input the length of a side of the hexagon: ");
double s = input.nextDouble();
System.out.print("The area of the hexagon is: " + hexagonArea(s)+"\n");
}
public static double hexagonArea(double s) {
return (6*(s*s))/(4*Math.tan(Math.PI/6));
}
}
Sample Output:
Input the length of a side of the hexagon: 6
The area of the hexagon is: 93.53074360871938
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer