I am havin an issue with the findVolume for the sphere part. It seems to ignore the "4/3" part but calculates everything else. Is there a way I can make it include this function?
Here is the code:
public class Sphere extends threeDShape{
double r;
public Sphere(double x, double y, double r){
super(x, y, r, r, r);
this.r = r;
}
public double findArea(){
return(double)((4*3.14*r*r));
}
public double findVolume(){
return (double)(4/3*3.14*r*r*r);
}
public double getR() {
return r;
}
public void setR(double r) {
this.r = r;
}
@Override
public String toString() {
return String.format("The area of the sphere is: " + findArea() +
"\nThe volume of the sphere is: " + findVolume());
}
}