class Area
{
double pi=3.14;
int r=Integer.parseInt(System.console().readLine("enter the value r"));
int h=Integer.parseInt(System.console().readLine("enter the value h"));
void areaOfCircle()
{
double area1=pi*r*r;
System.out.println("area of circle="+area1);
}
void areaOfCylinder()
{
double area2=2*pi*r*(r+h);
System.out.println("area of cylinder="+area2);
}
public static void main(String args[])
{
Area a=new Area();
a.areaOfCircle();
a.areaOfCylinder();
}
}
No comments:
Post a Comment