Cylinder details
class Cylynder
{
double radius;
double height;
void volume()
{
double vol=Math.PI*radius*radius*height;
System.out.println("volume is: "+vol);
}
void CirfaceArea()
{
double A=(2*Math.PI*radius*radius+2*Math.PI*radius*height);
System.out.println("Cirface Area is: "+A);
}
public static void main(String args[])
{
Cylynder myCylynder=new Cylynder();
myCylynder.height=15;
myCylynder.radius=7;
myCylynder.volume();
myCylynder.CirfaceArea();
}
}
Comments
Post a Comment