Write a Java program that calculates the circumference length and area of the RADIUS 3.0 and outputs the results.
Note: The system class math is in the Java.lang packet, and pi π can be obtained by the static attribute pi of the math class, which is defined as "public static final double PI = 3.14159265358979323846;".
1 PackageCom.hanqi;2 3 Importjava.lang.*;4 5 //Write a Java program that calculates the circumference length and area of the RADIUS 3.0 and outputs the results. 6 7 //Note: The System class math is located in the Java.lang packet, Pi Pi can be obtained by the static attribute pi of the math class.8 //it is defined as9 //"public static final double PI = 3.14159265358979323846;". Ten Public classYuan { One A - Public Static voidMain (string[] args) { - the DoubleR = 3.0; - - DoubleZhouchang = 2 * Math.PI *R; - + DoubleMianji = Math.PI * R *R; - +System.out.println ("perimeter of the garden =" +Zhouchang); A atSystem.out.println ("area of the garden =" +Mianji); - } -}
Learn to practice the perimeter area of the Java programming garden