if g is the number of gallons of gas you bought and b is the number of bottles of oil you bought, then we know that:
2.99g + 1.49b = 35.87
we have two unknowns and one equation. now, if this has integer solutions (which i would assume it does, since we are talking whole units here), we can do this by trial and error. otherwise, there must be some other clue. like what proportion of oil to gas you would need or something.