public class
Prism
{
public double width;
public double height;
public double depth;
public Prism(double width, double height, double depth)
{
this.width = width;
this.height = height;
this.depth = depth;
}
public Prism()
{
width = Math.random() * 10;
height = Math.random() * 10;
depth = Math.random() * 10;
}
public double volume()
{
return width * height * depth;
}
public double maxSide()
{
return Math.max(width, Math.max(height, depth));
}
public
String toString()
{
return "[W" + width + "
x H" + height + "
x D" + depth + "]";
}
}
|