NareshChowdary
progran
1 Answer(s)      4 years and 9 months ago
Posted in : Java Beginners

. Develop the program calculateCylinderVolume., which accepts radius of a cylinder's base disk and its height and computes the volume of the cylinder.

Advertisement
View Answers

December 13, 2010 at 11:46 AM


Hi Friend,

Try the following code:

import java.util.*;
class CalculateCyliderVolume
{
    public static void main(String[] args) 
    {   
        double PI=3.14;
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Radius: ");
        double r=input.nextDouble();

        System.out.print("Enter Height: ");
        double h=input.nextDouble();

        double volume=PI*r*r*h;
        System.out.println("Volume of Cylinder: "+volume);
        }
}

Thanks










Related Tutorials/Questions & Answers:
error in java progran at run time - Java Beginners
error in java progran at run time  Hello sir,,, i make a servlet program in java,,but i face some problem,,so please me.. Actually this type of error are come in my all servlet program My Servlet-- Error
Advertisements
error in java progran at run time - Java Beginners
error in java progran at run time  Hello sir,,, i make a servlet program in java,,but i face some problem,,so please me.. Actually this type of error are come in my all servlet program My Servlet-- Error