I have to invest $7000 and would like $300 as earnings from the investment. How much should I invest in stock that's getting 13% annual return and how much should I invest in a bond that pays 2%?

if there are $x at 13%, then the rest (7000-x) is at 2%.

So, just add up the interest from each. It needs to be $300:

.13x + .02(7000-x) = 300