Let X be the number of classes:
You need to multiply the cost per class by the number of classes.
For members you also need to add in the membership fee.
Members pay a total of 8 +4x
Non members pay a total of 6x
Set them to equal to solve for x, which is the number of classes taken:
8 + 4x = 6x
Subtract 4x from both sides:
8 = 2x
Divide both sides by 2:
x = 8/2 = 4
The answer is 4 classes.