Skip to content

Instantly share code, notes, and snippets.

Avatar

Haashim Rehan haashimrehan

View GitHub Profile
View VolumeCalc.java
public class VolumeCalc {
public static void main(String []args){
// Declare Variables
double radius = 10;
double volume = 0;
//While the radius is less than 200
@haashimrehan
haashimrehan / ThreeSphereCalc.java
Created Sep 7, 2018
Calculate the volume of three spheres
View ThreeSphereCalc.java
public class ThreeSphereCalc{
public static void main(String []args){
final double PI = 3.14159265358979;
double radius = 10;
double volume = 4.0/3.0*PI*radius*radius*radius;
System.out.println("The sphere with a radius of "+radius+" has a volume of " + volume);
radius = 20;
volume = 4.0/3.0*PI*radius*radius*radius;
System.out.println("The sphere with a radius of "+radius+" has a volume of " + volume);