求下列函数的最大值和最小值:

(1) $y=3+2 \cos \left(2 x+\frac{\pi}{3}\right)$;

(2) $y=2 \sin \left(2 x+\frac{\pi}{3}\right)\left(-\frac{\pi}{6} \leqslant x \leqslant \frac{\pi}{6}\right)$.
(1) $\because-1 \leqslant \cos \left(2 x+\frac{\pi}{3}\right) \leqslant 1$

$\therefore$ 当 $\cos \left(2 x+\frac{\pi}{3}\right)=1$ 时, $y_{\text {max }}=5$;

当 $\cos \left(2 x+\frac{\pi}{3}\right)=-1$ 时, $y_{\text {min }}=1$.

(2) $\because-\frac{\pi}{6} \leqslant x \leqslant \frac{\pi}{6}, \quad \therefore 0 \leqslant 2 x+\frac{\pi}{3} \leqslant \frac{2 \pi}{3}$,

$\therefore 0 \leqslant \sin \left(2 x+\frac{\pi}{3}\right) \leqslant 1$.

$\therefore$ 当 $\sin \left(2 x+\frac{\pi}{3}\right)=1$ 时, $y_{\text {max }}=2$;
当 $\sin \left(2 x+\frac{\pi}{3}\right)=0$ 时, $y_{\text {min }}=0$.