The table below displays the grade distribution of the $30$ students in a mathematics class on the last two tests.  For example, exactly one student received a 'D' on Test 1 and a 'C' on Test 2 (see circled entry).  What percent of the students received the same grade on both tests?

$\text{(A)}\ 12\% \qquad \text{(B)}\ 25\% \qquad \text{(C)}\ 33\frac{1}{3}\% \qquad \text{(D)}\ 40\% \qquad \text{(E)}\ 50\%$
We need to find the number of those who did get the same on both tests over 30 (the number of students in the class).
So, we have \[\frac{2 + 4 + 5 + 1}{30}\]
Which simplifies to \[\frac{12}{30} = \frac{4}{10} = \frac{40}{100} = 40 \%\]
$\boxed{\text{D}}$