For continuity at $x = 3$ and $x = 5$, left-hand and right-hand limits must be equal. At $x = 3$, the condition is: \[ a(3) + b = 7 \quad \text{(matching the second function part)} \] This yields $3a + b = 7$. For the condition at $x = 5$: \[ a(5) + b = 7 \quad \text{(again, matching the second function part)} \] Solving these simultaneous equations results in $a = -3$ and $b = -8$.