A. If given percents - make the mythical 100 gram sample and then turn it into moles. Divide the lowest number to get a ratio, if the ratio is a whole number (or close by .1 or .9) then you can round. If it is not a whole number you can multiply them ALL by 2,3,4,5,etc... to get them to whole numbers.
B. Given a compound weight - find the weight of the empirical formula and divide the given weight by the weight of the empirical formula. However many times the empirical weight goes into the compound weight must multiply the empirical formula by that number.