The volume is the product of the Length, Width, and Height: V = LWH.
We are given V = 240 in.3, and H = 6 in., and L = W + 3 in.
Thus 240 in.3 = (W+3 in.)*W*(6 in.) so W(W+3 in.) = 240 in.3 / 6 in. = 40 in.2
Using the distributive property and moving the constant to the left gives:
W2 + (3 in.)W - 40 in.2 = 0
(W + 8 in.)(W - 5 in.) = 0
The first factor gives W = -8 in. which is nonsense because it is negative.
The second factor gives a valid answer of W = 5 in.