How can I measure the amount of CO2 in grams in a known volume of soda based on its weight?

We have a soda machine that can fill either still water or soda. In both cases the amount is 400 ml in the beaker, but the soda weighs a little less.


How can we use the volume X = 400 ml and the weight Y = ?? grams to determine the amount of $\ce{CO2}$ in the solution?


