Explanation:
j = John's spending
p = Peter's spending
j(1/4) = (3/8)p
j/4 = 3p/8
p = j - 64
now we use the second equation in the first one :
j/4 = 3(j - 64)/8
we multiply both sides by 8
8×(j/4) = 3(j - 64)
2j = 3j - 192
192 = j
p = j - 64 = 192 - 64 = 128
John spent $192.
Peter spent $128.
in total they spent
192 + 128 = $320