To solve this you just have to use a rule of three to solve the percentages, remember that the 100% will be the 70 students, and we solve each case separetly:
70 students= 100%
sixth grades= 40%
Sixth grades= (40*70)/100
Sixth graders= 28
70 students= 100%
seventh grades= 20%
seventh graders= (20*70)/100
Seventh graders=14
So if we have that the rest of the students are eighth graders, we just add up the sixth and seventh graders and withdraw them from the total: