Let X be the number of 3 hour classes and Y the number of 4 hour classes.
We know that X + Y = 27 classes total.
Since each class has the same rate of $34/hour, we can find the total charge for each class:
X (3 hr classes) = 3*($34/hour) = $102/class
Y (4 hr. classes) = 4*($34/hour) = $136/class
The total income for 27 classes is $2958. This would be composed of the numbers of 3 and 4 hours classes times the fee for that class:
X: ($102/class)*(X classes)
Y ($136/class)*(Y classes)
Putting these into one equation:
102X + 136Y = 2958
We can use a definition of X by rearranging the first equation:
X + Y = 27 classes total
X = (27 - Y)
Put this into the second equation:
102X + 136Y = 2958
102*(27 - Y) + 136Y = 2958
2754 - 102Y + 136Y = 2958
34Y = 204
Y = 6
Since X = (27 - Y)
X = (27-6)
X = 21
There are 21 3 hr classes, and
6 4 hr classes
That is a total of 27 classes.
The income from these numbers is:
21*($102/class) = $2142
6*($136/class) = $ 816
$2958