rss
Twitter Delicious Facebook Digg Stumbleupon Favorites

Friday, October 7, 2011

Find the area and volume of a cylinder

A cylinder is one of the most basic curvilinear geometric shapes, the surface formed by the points at a fixed distance from a given line segment, the axis of the cylinder. The solid enclosed by this surface and by two planes perpendicular to the axis is also called a cylinder. The surface area and the volume of a cylinder have been known since deep antiquity.
In differential geometry, a cylinder is defined more broadly as any ruled surface spanned by a one-parameter family of parallel lines. A cylinder whose cross section is an ellipse, parabola, or hyperbola is called an elliptic cylinder, parabolic cylinder, or hyperbolic cylinder respectively.
In common use a cylinder is taken to mean a finite section of a right circular cylinder, i.e., the cylinder with the generating lines perpendicular to the bases, with its ends closed to form two circular surfaces, as in the figure (right). If the cylinder has a radius r and length (height) h, then its volume is given by

V = πr2h
and its surface area is:
  • the area of the top r2) +
  • the area of the bottom r2) +
  • the area of the side (rh).
Therefore without the top or bottom (lateral area), the surface area is:
A = 2πrh.
With the top and bottom, the surface area is:
A = 2πr2 + 2πrh = 2πr(r + h).
For a given volume, the cylinder with the smallest surface area has h = 2r. For a given surface area, the cylinder with the largest volume has h = 2r, i.e. the cylinder fits in a cube (height = diameter).

class Cylinder{
 String name;
     double p=3.141592654;
     double r=4;
     double h=5;
 void calculate(){
  System.out.println(2*p*r*h+2*p*r*r);
 }
 void calculate1(){
  System.out.println(p*r*r*h);
 }
}
class CalCy{
 public static void main(String args[]){
  Cylinder c1=new Cylinder();
  c1.name="Cylinder-Area";
  System.out.println(c1.name);
  c1.calculate();

 Cylinder c2=new Cylinder();
  c2.name="Cylinder-Volume";
  System.out.println(c2.name);
  c2.calculate1();
    }
}

0 comments:

Post a Comment

Powered by Blogger.