package chapter06;import java.util.Scanner;publicclassCode_35{
publicstaticvoidmain(String[] args){
Scanner inputScanner =newScanner(System.in);
System.out.print("Enter the side: ");double side = inputScanner.nextDouble();double area =area(side);
System.out.printf("The area of the pentagon is %f", area);}publicstaticdoublearea(double side){
double area =(5* Math.pow(side,2))/(4* Math.tan(Math.PI /5));return area;}}
結果は次のことを示しています。
Enter the side:5.5
The area of the pentagon is 52.044441
Process finished with exit code 0