-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMath1.java
More file actions
20 lines (16 loc) · 739 Bytes
/
Copy pathMath1.java
File metadata and controls
20 lines (16 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class Math1
{
public static void main(String[] args)
{
double earthdiameter = 7600;
double sundiameter = 865000;
double earthradius = earthdiameter/2;
double sunradius = sundiameter/2;
double earthvolume = (4.0/3.0)* Math.PI*Math.pow(earthradius,3);
double sunvolumne = (4.0/3.0)* Math.PI*Math.pow(sunradius,3);
double ratio = sunvolumne/earthvolume;
System.out.println("The volume of the Earth is " + earthvolume + " cubic miles.");
System.out.println("The volume of the Sun is " + sunvolumne + " cubic miles.");
System.out.println("The ratio of the volume of the Sun to the volume of the Earth is " + ratio);
}
}