Let be the amount invested at 8% interest

Let be the amount invested at 12% interest

then ............(1)

the interest gained on is dollars

the interest gained on is dollars

since the total interest gained is dollars, we have:

................(2)

now you have two equations and two unknowns, you can solve for and