1.8 (circle area and perimeter) programming, using the following formula radius of 5.5 and display area and the perimeter of a circle:
2 = circumference radius
Area = Radius radius
1.8 (Area and perimeter of a circle) Write a program that displays the area and perimeter of a circle that has a radius of 5.5 using the following formula:
perimeter = 2 radius
area = radius radius
Here is the answer Reference Code:
public class TheAreaAndThePerimeterOfCircleQuestion8 {
public static void main(String[] args) {
double the_radius_of_circle = 5.5,PI = 3.1415926;
double the_perimeter_of_circle = 2.0 * the_radius_of_circle * PI;
double the_area_of_circle = the_radius_of_circle * the_radius_of_circle * PI;
System.out.println("the perimeter of the circle : " + the_perimeter_of_circle);
System.out.println("the area of the circle : " + the_area_of_circle);
}
}
running result:
Note: Programming program to develop good habits
such as: 1. the file name to use English, specific point
2. Note To English
3. Variable name to be specific, not abstract (such as: a, b, c, etc.), to form the hump of
4. the overall writing style should be unified (Do not hump here, there is an underscore, the logic here is empty paragraph three rows, where the same logic paragraph 5 empty lines, etc.)