QuestionAsk Questions?

Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall.

View Answers

December 24, 2010 at 12:33 PM

Hello Friend,

Try the following code:

import java.util.*; class CalculatePipeArea{ public static void main(String[] args) { double PI=3.14; Scanner input=new Scanner(System.in); System.out.print("Enter Inner Radius: "); double r=input.nextDouble(); System.out.print("Enter Length: "); double h=input.nextDouble(); System.out.print("Enter thickness: "); double d=input.nextDouble(); double R=d+r; double area1=2*PI*r*h; double area2=2*PI*R*h; double a=Math.pow(R,2)-Math.pow(r,2); double area3=2*PI*a; double surfaceArea=area1+area2+area3; System.out.println(surfaceArea); } }

Thanks

Related Tutorials/Questions & Answers:

Advertisements