import java.util.Scanner;
/**
*
* @author jordanwhite
*/
public class MultiSphere {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int hairraiser1, hairraiser2, hairraiser3, sell, sell2;
Sphere ball_1;
Scanner jack;
ball_1 = new Sphere();
ball_1.setDiameter();
hairraiser2 = ball_1.getVolume();
hairraiser3 = ball_1.getSurface();
System.out.println ();
System.out.println ("Volume: " + hairraiser2);
System.out.println ("Surface: " + hairraiser3);
}
}
For the class that should go with it:
import java.util.Scanner;
/**
*
* @author jordanwhite
*/
public class Sphere{
private int diameter, volume, surface, radius;
public void setDiameter (Scanner diam, int length){
diameter = length;
diam = new Scanner (System.in);
System.out.println("Enter Diameter: " + diam);
length = diam.nextInt();
}
public int getDiameter(){
return diameter;
}
public int getVolume(){
radius = diameter / 2;
volume = (int) (4 / 3 * Math.PI * Math.pow(radius, 3));
return volume;
}
public int getSurface(){
surface = (int) (4 * Math.PI * Math.pow(radius, 2));
return surface;
}
public String toString(){
String result1 = Integer.toString(volume, surface);
return result1;
}
}
Do you think that would be all, and an awesome Black Label Beer animation?:
1950s Black Label Beer commercial
Not only am I a computer science fan, but also an animation fan. I actually saw Toy Story when it came out when I was 4 years old. Have been a fan of Pixar ever since. They're another reason why I got into computers. So, can you please help me with this code?

New Topic/Question
Reply




MultiQuote



|