1  /**
  2     This program computes the volumes of two cubes.
  3  */
  4  public class Cubes
  5  {
  6     public static void main(String[] args)
  7     {
  8        double result1 = cubeVolume(2);
  9        double result2 = cubeVolume(10);
 10        System.out.println("A cube with side length 2 has volume " + result1);
 11        System.out.println("A cube with side length 10 has volume " + result2);
 12     }
 13  
 14     /**
 15        Computes the volume of a cube.
 16        @param sideLength the side length of the cube
 17        @return the volume
 18     */
 19     public static double cubeVolume(double sideLength)
 20     {
 21        double volume = sideLength * sideLength * sideLength;
 22        return volume;
 23     }
 24  }