I will do the last part.

$$g(x) = 0, h(x) = \begin{cases} \cos(x) &\mbox{if } |x| < \frac{\pi}{2} \\

0 & \mbox{if } |x| \geq \frac{\pi}{2}. \end{cases}$$

The solution is $$u=\frac{1}{2c}\int^{x+ct}_{x-ct}h(y)dy$$

Let $H$ be the primitive of $h$, i.e $H'(y)=h(y)$

Then $$H(y)=\begin{cases} 0 &\mbox{if } y \leq -\frac{\pi}{2} \\

\sin(y)+1 & \mbox{if } -\frac{\pi}{2} < y < \frac{\pi}{2} \\ 2 & \mbox{if } y \geq \frac{\pi}{2}. \end{cases}$$

And we have $$u=\frac{1}{2c}[H(x+ct)-H(x-ct)]$$

Since g and h here are also even with respect to x, we apply the same logic as the professor and only worry about $x>0$ and $t>0$.

So we have $$u(x,t)=\begin{cases} \frac{1}{c} &\mbox{if } x-ct \leq -\frac{\pi}{2}, x+ct \geq \frac{\pi}{2} \\

\frac{1}{2c}[1-\sin(x-ct)] & \mbox{if } -\frac{\pi}{2} < x-ct < \frac{\pi}{2}, x+ct \geq \frac{\pi}{2} \\ 0 & \mbox{if } x-ct \geq \frac{\pi}{2}, x+ct \geq \frac{\pi}{2} \\ \frac{1}{2c}[\sin(x+ct)-\sin(x-ct)] & \mbox{if } -\frac{\pi}{2} < x-ct < \frac{\pi}{2}, -\frac{\pi}{2} < x+ct < \frac{\pi}{2} \end{cases}$$

Then we can use the symmetry of u to find its value in other regions.