The ratio between boys and girls in a class is 3 : 1. Find the number of boys in the class is the total number of students is 40.