title: JAVA Formula for the calculation of the area of a pentagon
body: <p>I hope you can help me out with this. I am trying to find the area of a pentagon. I know the formula however my answer does not match the correct answer. </p>
  
  <p>I should be able to get the area by utilizing the math.sqrt but I am having a rough time simplifying the formula and combining it in such a way that the output is correct.</p>
  
  <p>Here is my code</p>
  
  <pre><code>System.out.println("What shape do you need to know the area of?\n" +
      "1: Determine the Area of a Square?\n" +
      "2: Determine the Area of a Circle?\n" +
      "3: Determine the Area of a Ellipse?\n" +
      "4: Determine the Area of a Pentagon? \n" +
      "5: Exit\n"     
      );
  
      Scanner reader = new Scanner(System.in);
      System.out.println("Selection: ");
      int input = reader.nextInt();
      reader.nextLine();
  
      Scanner scan = new Scanner(System.in);
  
      }
  if (input == 4){
          System.out.println("What is a length of 1 side of the Pentagon? ");
          int n = scan.nextInt();
      // Calculate the area based on formula
          double area = (n * Math.pow(n, 2)) / (4 * Math.tan(Math.PI / n));
      //Print result
          System.out.println (" Area of regular pentagon is " + area);
      }
  </code></pre>