There is 40% of oxygen. If your mineral sample has a mass of 10g, how many grams of oxygen does it have. wouldn't it have 4 grams?

yes, exactly right.