Java Reference
In-Depth Information
public class
Box
extends
Rectangle
{
private double
height;
public
Box()
{
//The definition is as given below
}
public
Box(
double
l,
double
w,
double
h)
{
//The definition is as given below
}
public void
setDimension(
double
l,
double
w,
double
h)
{
//Sets the length, width, and height of the box
//The definition is as given below
}
public double
getHeight()
{
return
height;
}
public double
area()
{
//Returns the surface area
//The definition is as given below
}
public double
volume()
{
1
0
//Returns the volume
//The definition is as given below
}
public String
toString()
{
//Returns length, width, and height of the box as
//a string. The definition is as given below.
}
}
Figure 10-3 shows the UML class diagram of the
class
Box
and the inheritance
hierarchy.
Search WWH ::
Custom Search