A simplistic program to compute the volume of a cylinder when its radius and length are input via MyInput.class
CylinderVolume
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));
}
}
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.