Hi Aman how do you attach a mass of M/2 to both the parts. It should also be a function of soda in the can.
Ayush here comes my answer. I am answering just part (d) and all the answers will come from there. Let at any time the cylinder contains soda upto a height x.
Mass of can=M
center of mass of can = H/2
Mass of soda upto level x = mx/H
center of mass os soda = x/2
Center of mass of whole system (h)=(MH/2+mx^2/(2H))/(M+mx/H)
for part a) and b) put x=H and x=0 and you get h+H/2
for c) minimize x by diffrentiating h