hi friend its simple
initially when no soda was filled the centre of mass will be at the centre of the cylinder of the cylinder
now considering the case (a)
now consider the cylinder to be made up of two parts
one with height h (lower one )
and other with height H-h(upper one)
now calculate the centre of mass of lower part it will be at h/2(from symmetry)
from centre of cylinder and will have mass M/2+m
now calculate the centre of mass of the upper part
again it will be at height (H-h)/2 from the centre of the cylinder and
will have mass=M
consider the two centre of masses as point and calculate their centre of mass
it will come by taking proper sign convention taking origine to be centre of
cyliner.you will get the ans easily of other also
plzz rate me