I would do this as a proportionality problem:
V = 1/3 Ah where A is the area of the base and h is the height.
Vi = 1/3 Aihi for any case i , so if we are given all the values for case 1 and need one of the values for case 2 you can use the proportion:
V2/V1 = (A2/A1)(h2/h1) or
V2= (24 m3)(21m2/18m2)(7 m/4 m) This is like the combined gas law in chemistry. Note that the units need only be consistent within the parentheses.
Good luck!