-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCylinderComputation.java
More file actions
33 lines (25 loc) · 976 Bytes
/
CylinderComputation.java
File metadata and controls
33 lines (25 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
public class CylinderComputation {
public static void main(String[] args) {
double radius, height, surfaceArea, baseArea, volume, diameter;
final double PI = 3.1416;
radius = 5;
height = 8;
diameter = radius * 2.0;
baseArea = PI * radius * radius;
surfaceArea = (2 * PI * radius * height) + (2 * PI * (radius * radius));
volume = PI * radius * radius * height;
System.out.print("The radius is ");
System.out.println(radius);
System.out.print("The hight is ");
System.out.println(height);
System.out.print("The diameter is ");
System.out.println(diameter);
System.out.print("The baseArea is ");
System.out.println(baseArea);
System.out.print("The surfaceArea is ");
System.out.println(surfaceArea);
System.out.print("The volume is ");
System.out.println(volume);
System.out.println(":P");
}
}