We have:
7 students from the junior class
10 students from the senior class
So:
We need 5 from the senior class
There are a total of 17 students so. the ones that can be any grade are:

since you need a total of 8 students in the committee and 5 have to be in the categories described above, that leaves:

That can be any grade.
Therefore:

Where the combination formula is given by:
