(i) In rupees, the girls collected 24×180=4320 in all and the boys collected 150b in all. The class average is the total collected divided by the number of children:
24+b4320+150b=162
(ii) Multiply both sides by 24+b:
4320+150b=162(24+b)=3888+162b
4320−3888=162b−150b, so 432=12b
So b=36. There are 36 boys in the class.
Check: 604320+150×36=604320+5400=609720=162. The class average is closer to ₹150 than to ₹180, which fits: there are more boys than girls.