/* a program to compute the area of a pentagon given the distance between the center and one of the vertices */ import java.util.*; // for a Scanner public class Prog4_1 { public static void main(String[] args) { double r, s, area; // r = radius, s = side Scanner in=new Scanner(System.in); // create a Scanner System.out.print("Enter the distance between the central point of the pentagon and a vertex (r): "); r = in.nextDouble(); // radius should be a double s = 2 * r * Math.sin(Math.PI/5); // compute the side area = 5 * s * s / (4 * Math.tan(Math.PI/5)); // compute the area area = Math.round(area * 100) / 100.0; // reduce the number of decimal points of accuracy to 2 System.out.println("The area of the pentagon is " + area); // output result } }