QuestionAsk Questions?

Develop the program calculateCylinderArea, which accepts radius of the cylinder's base disk and its height and computes surface area of the cylinder.

View Answers

December 14, 2010 at 1:35 PM

Hello Friend,

Try the following code:

import java.util.*; class CalculateCylinderArea { 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 v1=2*pi*r*r; double v2=2*pi*r*h; double surfaceArea=v1+v2; System.out.println("Surface Area of Cylinder: "+surfaceArea); } }

Thanks

Related Tutorials/Questions & Answers: