2p = number of quarters, since we have twice as many quarters compared to pennies.
Based on that, we know,
p = number of cents from the pennies (1 penny = 1 cent)
5n = number of cents from the nickels (5 nickels = 5 cents, multiply both sides by n)
25(2p) = 50p = number of cents from the quarters
and ultimately
p+5n+50p = 51p+5n
represents the total value of all the coins, and this value is in cents. We would divide by 100 to convert from cents to dollars. So we can say that 51p+5n cents = (51p+5n)/100 dollars
----------------
As an example, let's say
p = 4
n = 5
So we have
p = 4 pennies
n = 5 nickels
q = 2p = 2*4 = 8 quarters
This would mean we have
p = 4 cents from the pennies only
5n = 5*5 = 25 cents from the nickels only
25q = 25*8 = 200 cents from the quarters only
Overall we have p+5n+25q = 4+25+200 = 229 cents which converts to 229/100 = $2.29
We can also say 51p+5n = 51*4+5*5 = 204+25 = 229 which is a slight shortcut to get the same result (that result being in cents).