3:50 pm - Thursday February 19, 5598

Java Example Program to find curved Surface Area of Cylinder

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
//find curved Surface Area of Cylinder
/**
 * @author:candidjava.com
 * @description:to find the curvedsurfaceArea of a cube by using the 'radius'
 *                 and 'height' values
 */
public class Cylinder {
	double radius;
	double height;
	double curvedSurfacearea;

	public void curvedSurfacearea() // curvedSurfacearea calculation
	{
		curvedSurfacearea = 2 * 3.14 * radius * height;
	}

	public static void main(String arg[]) {
		Cylinder c1 = new Cylinder();
		c1.radius = 5.0;
		c1.height = 8.0;
		c1.curvedSurfacearea(); // calling the function curvedSurfacearea
		System.out.println(c1.curvedSurfacearea);
	}
}

output:
251.200000000002

Filed in: Z-A All Java Codes

Comments are closed.