If 4/7 are boys, then 3/7 must be girls (unless you have some sort of transgender thing going). So the 18 boys that are MORE than the number of girls must be equal to 1/7 of the class. So if 1/7 of the class is 18, the class must be 18 times 7.
John
My calculator said it, I believe it, that settles it