The ratio of class 1 to class 2 is 8 to 7. If eight students from class 1 are transferred to class 2, the ratio of class 1 to class 2 is 4 to 5. How many students are there in each class

The ratio of class 1 to class 2 is 8 to 7. If eight students from class 1 are transferred to class 2, the ratio of class 1 to class 2 is 4 to 5. How many students are there in each class

8+7=15
The original number of the first class accounts for 8 / 15 of the total number of the two classes
4+5=9
If 8 students in class 1 are transferred to class 2, the number of students in class 1 accounts for 4 / 9 of the total number of students in class 2
The original total number of two classes is: 8 ÷ (8 / 15-4 / 9) = 90
Therefore, the original class had: 90 × 8 / 15 = 48 people
Class 2: 90 × 7 / 15 = 42