|
|
|
|
|
|
|
|
|
|
|
public
class RectangularParallelopiped extends
|
|
|
Polyhedron {
|
|
private double width, length, height;
|
|
|
// A constructor - It sets protected parent variables:
|
|
|
RectangularParallelopiped
|
|
(double theWidth, double theLength,
double theHeight) {
|
width=theWidth; length=theLength;
height=theHeight;
|
|
nFaces = 6; nVertices = 8; nEdges =
12;
|
|
|
}
|
|
// A concrete method for the parent’s abstract method:
|
|
public double volume() {
|
|
return width * length * height;
|
|
|
}
|
|
}
|
|