I'm not sure how the correct way to do this would be but if you have a ratio that is 5:2 think of it as having 5 groups of animals and 2 groups of animals.
Find the number by dividing the total amount of animals 98/7 = 14.
We know that there are 5 groups of cats, the ratio for 5 cats. 14 x 5 = 70.
The remainder is dogs, which has a ratio of 2:5. 14 x 2 = 28.