$f(2^-) = a \sin(2\pi)+ b = b$
$f(2^+) = 2^2 + a = 4+a$
For continuity at $x=2$ we must have $b = a+4$
$f(9^-) = 9^2 + a = 81+a$
$f(9^+) = b \cos(2\pi 9)+a = (a+4)\cos(18\pi)+a = 2a+4$
Similarly for continuity at $x=9$ we must have
$81+a = 2a+4$
$a=77$
$b = 81$