Randy's parents gave him an allowance of d dollars each month. One month, he put half of his allowance in the bank and then bought a book for $8. He had $12 left in his pocket after buying the book. Write an equation to solve for the amount of Randy's monthly allowance. Then, solve it.​