Each child ticket for a ride costs $3, while each adult ticket costs $5. The ride collected a total of $150, and 40 tickets were sold. How many of each type of ticket were sold?
A. 150 child and 40 adult
B. 24 adult and 10 child
C. 30 child and 10 adult
D. 25 child and 15 adult