class Area{
final float PI=3.14f;
float arac,aracy;
int r=2,h=3,l=4;
void areaofcircle()
{
arac=PI*r*r;
System.out.println("area of circle="+arac);
}
void areaofcylinder()
{
aracy=((PI*r*r*h)+(2*PI*r*l));
System.out.println("area of cylinder="+aracy);
}
}
class area2{
public static void main(String[] arg)
{
area ob=new area();
ob.areaofcircle();
ob.areaofcylinder();
}
}
final float PI=3.14f;
float arac,aracy;
int r=2,h=3,l=4;
void areaofcircle()
{
arac=PI*r*r;
System.out.println("area of circle="+arac);
}
void areaofcylinder()
{
aracy=((PI*r*r*h)+(2*PI*r*l));
System.out.println("area of cylinder="+aracy);
}
}
class area2{
public static void main(String[] arg)
{
area ob=new area();
ob.areaofcircle();
ob.areaofcylinder();
}
}
No comments:
Post a Comment