Write a program with overloaded function volume() to calculate the volume of cube,cuboid and a cylinder

01/01/2002 08:01

 

public class husain
{
void volume(int l,int b,int h)
{
int volume=l*b*h;
System.out.println(volume);
}
void volume()
{
int side=5;
int volume=side*side*side;
System.out.println(volume);
}
void volume(double a,double b,double c)
{
double d=a*b*c;
double volume=d*b;
System.out.println(volume);
}
public static void main(String args[])
{
husain obj=new husain();
obj.volume(5,10,15);
husain ob1=new husain();
ob1.volume();
husain ob2=new husain();
ob2.volume(3.14,5,10);
}
}

volume of cylinder is(3.14r2h)