class Box
{
double width;
double height;
double depth;
Box(Box ob)
{
width=ob.width;
height=ob.width;
depth=ob.depth;
}
Box(double w, double h,double d)
{
width=w;
height=h;
depth=d;
}
Box(double d)
{
width=d;
height=d;
depth=d;
}
void volume()
{
System.out.println("\n the volume is " +width*height*depth);
}
}
class B extends Box
{
double weight;
B(double a,double b,double c, double d)
{
super(a,b,c);
weight=d;
}
void show()
{
System.out.println("\n Weight is "+weight);
}
}
class C
{
public static void main(String args[])
{
B ob=new B(5,6,10,4);
ob.volume();
ob.show();
}
}
{
double width;
double height;
double depth;
Box(Box ob)
{
width=ob.width;
height=ob.width;
depth=ob.depth;
}
Box(double w, double h,double d)
{
width=w;
height=h;
depth=d;
}
Box(double d)
{
width=d;
height=d;
depth=d;
}
void volume()
{
System.out.println("\n the volume is " +width*height*depth);
}
}
class B extends Box
{
double weight;
B(double a,double b,double c, double d)
{
super(a,b,c);
weight=d;
}
void show()
{
System.out.println("\n Weight is "+weight);
}
}
class C
{
public static void main(String args[])
{
B ob=new B(5,6,10,4);
ob.volume();
ob.show();
}
}
No comments:
Post a Comment