have to creat a geosolid class that has 3 sub class i choose sphere cylinder and cone, i got the first two to work but my cone class works except when it calculates the volume it keep getting 0 no matter what number is use for the hieght and radius
import java.util.Scanner;
import java.text.DecimalFormat;
public class Cone extends GeoSolids
{
double vol, surf_area;
int size = 0;
public Cone(int radi, int h)
{
super(radi, h);
}
public double calcV()
{
vol = 1/3 * Math.PI * height * Math.pow(radius, 2);
return vol;
}
public double calcSurf_A()
{
surf_area = Math.PI * radius * size
+ Math.PI * Math.pow(radius, 2);
return surf_area;
}
public String toString()
{
DecimalFormat fmt = new DecimalFormat("0.##");
return super.toString() + "\nThe volume is " + fmt.format(vol)
+ "\nThe surface area is " + fmt.format(surf_area);
}
}
cna some please help me fix this problem