AP Chemistry
posted by R .
When a sample of methyl salicylate weighing 5.287 grams is burned in excess oxygen, 12.24 grams of CO2 and 2.522 grams of H2O are formed. What is the empirical formula for oil of wintergreen?
I know the answer is C8H8O3, I just need help finding out how to solve the problem. Thanks for any help in advance.

(a) Convert the grams of CO2 to moles of CO2 by dividing grams of CO2 by the molar mass of CO2.
Moles of CO2 = moles of carbon, C. Multiply moles of C by 12.011g/mol to get grams of carbon in the sample.
(b) Find the moles of H2O in a similar way.
Moles of H = (2)(moles of H2O). To get grams of H, multiply moles of H times 1.00794 g/mol
(c) Grams of O in the sample = (grams of sample)  (grams H + grams H)
(d) Convert grams O to moles
(e) Divide moles C, moles H, and moles O by the smallest of the three. This will give you a ratio of three numbers. Multiply those numbers if needed to get three whole numbers. The three whole numbers are the three subscripts in the empirical formula. 
Clarification: In the last step multiply the three numbers in the mole ratio by the same number. Select the smallest multiplier that will give a three whole number ratio. Tose three numbers are your subscripts.