Let x be the number of students on Alberto's class. Since he gave two pieces to each student, the total number of pieces of gum that he gave was 2x.
The number of pieces remaining after giving 2x of them, is 70-2x. This must be equal to 8. Then, we can represent the situation using the following equation:
Solve for x:
Then, there are 31 students in his class.