public class Demo03 {
public static void main(String[] args) {
System.out.println(round2(getArea(13)));
//System.out.println(round2(3.7485926));
}
//求正三角形外接圆面积
public static double getArea(int m){
//已知正三角形外接圆面积公式:PI*m*m/3
double s=Math.PI*m*m/(3*1.0);
return s;
}
//对一个double类型进行四舍五入保留两位小数的操作
public static double round2(double d){
return (Math.round(d*100))/100.0; //系统提供的round方法
}
}