Answer
The earthquake occurred a distance of $~~1900~km~~$ away.
Work Step by Step
Let $d$ be the distance between the location of the earthquake and the seismograph.
We can find an expression for the time it took the P waves to reach the seismograph:
$t_P = \frac{d}{8.0~km/s}$
We can find an expression for the time it took the S waves to reach the seismograph:
$t_S = \frac{d}{4.5~km/s}$
Note that $t_S = t_P+180~s$
We can use $t_S$ to find another expression for the time it took the P waves to reach the seismograph:
$t_S = \frac{d}{4.5~km/s} = t_P+180~s$
$t_P = \frac{d}{4.5~km/s} - 180~s$
We can find $d$:
$\frac{d}{8.0} = \frac{d}{4.5} - 180$
$(d)(4.5) = (d)(8.0) - (180)(8.0)(4.5)$
$(d)(8.0-4.5) = (180)(8.0)(4.5)$
$d = \frac{(180)(8.0)(4.5)}{3.5}$
$d = 1900~km$
The earthquake occurred a distance of $~~1900~km~~$ away.