Let n be the number of nickels and q be the number of quarters.
We have two equations:
(1) n + q = 24
(2) 0.05n + 0.25q = 3
Rearrange (1) to solve for n in terms of q for another equation (3)
(3) n = 24 - q
Plug (3) into (2)
0.05(24 - q) + 0.25q = 3
Multiply through:
1.2 - 0.05q + 0.25q = 3...