As stated in a comment, for b) always shoot at window $A$.
For a), if you shoot $n_A$ times at window $A$ and $21-n_A$ times at window $B$, your chance of hitting the rabbit is
$$ \frac89\left(1-\left(\frac12\right)^{n_A}\right)+\frac19\left(1-\left(\frac12\right)^{21-n_A}\right)\;. $$
Setting the derivative with respect to $n_A$ to zero yields
$$ \frac89\left(\frac12\right)^{n_A}=\frac19\left(\frac12\right)^{21-n_A} $$
and thus
$$ 8=2^{2n_A-21} $$
with solution $n_A=12$, so you should fire $12$ times at window $A$ and $9$ times at window $B$.