In a class of students, the following data table summarizes how many students have a cat or a dog. What is the probability that a student chosen randomly from the class has a dog?
Has a cat Does not have a cat
Has a dog 2 7
Does not have a dog 12 12 6