CylinderVolume

Updated Dani 0 Tallied Votes 188 Views Share

A simplistic program to compute the volume of a cylinder when its radius and length are input via MyInput.class

package cylindervolume;
public class CylinderVolume
{
    public static void main(String args[])
    {
        double pi = 3.14;
        double radius, length;
        System.out.print("Please enter radius of cylinder: ");
        radius = MyInput.readDouble();
        System.out.print("Please enter length of cylinder: ");
        length = MyInput.readDouble();
        System.out.print("Volume = " + (radius*radius*pi*length));
    }
}