Let x represent the side length of the square end, and let d represent the dimension that is the sum of length and girth. Then the volume V is given by
 V = x²(d -4x)
Volume will be maximized when the derivative of V is zero.
 dV/dx = 0 = -12x² +2dx
 0 = -2x(6x -d)
This has solutions
 x = 0, x = d/6
a) The largest possible volume is
 (d/6)²(d -4d/6) = 2(d/6)³
 = 2(108 in/6)³ = 11,664 in³
b) The dimensions of the package with largest volume are
 d/6 = 18 inches square by
 d -4d/6 = d/3 = 36 inches long