The molecular mass is a number that tells us two things: 1) how many grams of an element or compound there are in one mole (6.02 x 10^23 units) of that substance, and 2) What one molecule of the substance weighs in Atomic Mass Units, or AMUs.
In this case, we know that the molecular mass is 30 AMU. If 79.9% of that is coming from the carbon molecule(s), then the remaining 20.1% is the weight of the hydrogen atoms.
The first step is to assume that you have 100 grams of the substance. In that case, 79.9 grams of it would be composed of carbon and 20.1 grams would be hydrogen.
Next figure out how many moles of each element that would be:` <br> `
79.9gCarbon x 1 Mole Carbon/12 g Carbon = 79.9/12= 6.66 Moles C
20.1g Hydrogen x 1 Mole Hydrogen/1 g Hydrogen = 20.1 Moles H
Then you divide each amount of moles by the smallest value:
6.66 C/6.66 = 1 Carbon
20.1H/6.66 = 3 Hydrogen
This means the empirical (simplest) formula for your molecule is CH3