There seems to be a little missing here from the problem. Further, the final question is asking the probability that if someone wearing sunglasses is randomly selected that they are also wearing a cap.
The other piece missing from the problem: If one of the people wearing a cap is selected at random, the probability that this person is is also wearing sunglasses is $\dfrac{2}{5}$. This is key to solving the question!
This probability, along with the fact that there are $35$ people wearing caps tells us that there must be $\dfrac{2}{5}\times 35 = 14$ people who are wearing both sunglasses and caps.
To double check, we calculate this probability as the total number of people wearing both sunglasses and caps divided by the total number wearing caps: $\dfrac{14}{35} = \dfrac{2}{5}$.
The problem asks us the probability that a random person wearing sunglasses is also wearing a cap. This probability can be calculated similarly to how we calculated the probability of $\dfrac{2}{5}$ above.