Question: Topic: Mathematical Functions, Characters, and Strings Question: (4-4) (Geometry: area of a hexagon) The area of a hexagon can be computed using the following formula
Topic: Mathematical Functions, Characters, and Strings
Question: (4-4) (Geometry: area of a hexagon) The area of a hexagon can be computed using the following formula (s is the length of a side): 6 times s squared over 4 times the tan(pi/6)
I've created the following code:
But I get the following error below. What am I missing or what do I need to omit?

AreaHexagon.java E = H E 0 Java 1 import java.util.Scanner; import java.text.DecimalFormat; 3 public class AreaHexagon { public static void main(String[] args) { Scanner in = new Scanner(System.in); DecimalFormat twoDForm = new DecimalFormat("#. ##"); System.out.print("Enter the side:"); double side = in.nextDouble(); double area = 6 * Math.pow(side, 2) 1 (4 * Math.tan (Math. System.out.println("The area of the hexagon is " + twoDFO 11 12 } COMPILER ERROR MESSAGES AreaHexagon.java:14: error: class, interface, or enum expected HNMONO 1 error 1 import java.util.Scanner; 2 import java.text.DecimalFormat; 3 public class AreaHexagon { public static void main(String[] args) { Scanner in = new Scanner (System.in); DecimalFormat twoDForm = new DecimalFormat("#.##"); System.out.print("Enter the side:"); double side = in.nextDouble(); double area = 6 * Math.pow( side, 2) 1 (4 * Math.tan (Math.PI / 6)); System.out.println("The area of the hexagon is " + twoDForm.format(area)); 12 } 13 14 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
