Let x be the cost of a hot dog and y be the cost of a cheeseburger. Then we can set up the following system of equations:
3x + 2y = 31.25
5x + 2y = 41.75
We can solve for one of the variables by subtracting the first equation from the second:
5x + 2y - (3x + 2y) = 41.75 - 31.25
2x = 10
x = 5
Substituting x = 5 into either of the equations above gives:
3(5) + 2y = 31.25
15 + 2y = 31.25
2y = 16.25
y = 8.125
Therefore, a hot dog costs $5 and a cheeseburger costs $8.125.