To find $ P(B~|~A) $ we use Bayes formula:
$$\color{blue}{ P(A ~|~ B) = \frac{ P(B ~|~ A) \cdot P(A)} {P(B)}}$$In this example we have:
$$ \begin{aligned} P(A ~|~ B) &= \frac{ P(B ~|~ A) \cdot P(A)}{P(B)} \\ 0.6 &= \frac{ P(B~|~A) \cdot 0.4 }{ 0.5 } \\ P(B~|~A) &= \frac{ 0.6 \cdot 0.5 }{ 0.4 } \\ P(B~|~A) &= \frac{ 0.3 }{ 0.4 } \\ P(B) &= 0.75 \end{aligned}$$