Final answer:
Joseph had $42 in his wallet before he bought the game.
Step-by-step explanation:
To solve this problem, we can set up an equation:
Let x be the initial amount of money in Joseph's wallet.
Joseph spent half the money, so he has x/2 remaining.
After earning $10, Joseph's wallet has a total of x/2 + $10 = $31.
Let's solve for x:
x/2 + $10 = $31
x/2 = $21
To solve for x, we multiply both sides of the equation by 2:
x = $42
Therefore, Joseph had $42 in his wallet before he bought the game.