We can use the Law of Cosines because we know \(a,b\) and \(C\text{.}\)
\begin{align*}
c^2 \amp = 5^2+7^2-2(5)(7)\cos(40^\circ)\\
c^2 \amp \approx 20.38.\\
\sqrt{c^2} \amp \approx \sqrt{20.38}.\\
c \amp \approx 4.51.
\end{align*}
Now that we know a side and the angle opposite it, we can use the Law of Sines to find the remaining two angles.
\begin{align*}
\frac{\sin(40^\circ)}{4.51} \amp = \frac{\sin(A)}{5}.\\
5 \cdot \frac{\sin(40^\circ)}{4.51} \amp = 5 \cdot \frac{\sin(A)}{5}.\\
0.7126 \amp = \sin(A).\\
\arcsin(0.7126) \amp = A.\\
45.45 \amp \approx A.
\end{align*}
Finally we can use the angle sum theorem to calculate the final angle. \(40+45.45+B = 180\) so \(B=94.55\text{.}\)