Answer:
Let x be the width of the compartment,
Then according to the question,
The length of the compartment = x + 2
And the depth of the compartment = x -1
Thus, the volume of the compartment, 
But, the volume of the compartment must be 8 cubic meters.
⇒ 
⇒ 
⇒ 
If
and if 
But, width can not be the complex number.
Therefore, width of the compartment = 2 meter.
Length of the compartment = 2 + 2 = 4 meter.
And, Depth of the compartment = 2 - 1 = 1 meter.
Since, the function that shows the volume of the compartment is,

When we lot the graph of that function we found,
V(x) is maximum for infinite.
But width can not infinite,
Therefore, the maximum value of V(x) will be 8.