pyramidVolume return type is void. Change return type to double as below: public static double pyramidVolume (double baseLength, double baseWidth, double pyramidHeight)