Box.java
public class Box
{
private double height;
private double width;
private double depth;
/**
Constructs a box with a given side length.
@param sideLength the length of each side
*/
public Box(double h, double w, double d)
{
// your work here
}
/**
Gets the volume of this box.
@return the volume
*/
public double volume()
{
// your work here
}
/**
Gets the surface area of this box.
@return the surface area
*/
public double surfaceArea()
{
// your work here
}
}
Use the following file:
BoxTester.java
public class BoxTester
{
public static void main(String[] args)
{
Box myBox = new Box(10, 10, 10);
System.out.println(myBox.volume());
System.out.println("Expected: 1000");
System.out.println(myBox.surfaceArea());
System.out.println("Expected: 600");
myBox = new Box(10, 20, 30);
System.out.println(myBox.volume());
System.out.println("Expected: 6000");
System.out.println(myBox.surfaceArea());
System.out.println("Expected: 2200");
}
}