太难了,一直写不出来,我太垃圾了,题目在图上,请问一下有人帮助吗?

img

2.16 题

public class App {

    public static void main(String[] args) throws IOException {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Enter the length of the side:");
        double length = scanner.nextDouble();
        double area = 3 * Math.sqrt(3) * Math.pow(length, 2) / 2;
        System.out.println("the area of the hexagon is " + area);
    }

}

img

static double sqrt​(double a) 返回 double值的正确舍入正平方根。
static double pow​(double a, double b) 返回第一个参数的值,该值是第二个参数的幂。