I only did H₂O because you can apply this process for the rest but
First we need to find the molar mass of H₂O from the periodic table by adding said elements atomic masses together. 1.01(2) + 16.00=18.02g/mol
We can use this 18.02g/mol as a conversion from moles to grams.
Since there are molecules we need to use Avagadros number 6.02x10^23. This number can be used for molecules, particles and atoms and can convert from molecules, particles and atoms to moles.
Now we use dimensional analysis so our units cancel
your answer will be 161.6 but the least significant figures is 3 so round to 162
SO in general you need to calculate the molar mass of said species so you can convert to your desired units, hope this helped!!