Isaac has a total of thirty-one quarters and pennies. He has nine more pennies than quarters. How many of each coin does he have?

p + q = 31

p = q + 9
so
2 q + 9 = 31
2 q = 22
q = 11
then p = q + 9 = 20