class box
{
double width;
double height;
double depth;
box(box o)
{
width=o.width;
height=o.height;
depth=o.depth;
}
box(double w,double h,double d)
{
width=w;
height=h;
depth=d;
}
box()
{
width=20;
height=40;
depth=50;
}
box(double x)
{
width=height=depth=x;
}
double volume()
{
return width*height*depth;
}
}
class conoap
{
public static void main(String args[])
{
box mybox1=new box(10,40,20);
box mybox2=new box();
box mycube=new box(8);
box myref=new box(mybox1);
double vol;
vol=mybox1.volume();
System.out.println(vol);
vol=mybox2.volume();
System.out.println(vol);
vol=mycube.volume();
System.out.println(vol);
vol=myref.volume();
System.out.println(vol);
}
}
Subscribe to:
Post Comments (Atom)
MY HIT COUNTER
Blog Archive
-
▼
2009
(38)
-
▼
November
(27)
- few programs on bank project
- customer identification number
- bank programs
- min balance program in oracle
- cards balance
- real time programs in bank project
- real time registration example
- Creation of tables in oracle
- practice quries
- quries
- reverse number
- throws exception
- throws exception
- divide by zero
- array index
- length of a string name
- no parameters to string
- print two parameters
- abstract class in core java
- inside area of rectangle
- area of rectangle
- three string parameters
- class b extends a
- incremeting numbers
- sum of three parameters
- box program
- strings
-
▼
November
(27)
Custom Search
No comments:
Post a Comment