Let the number of students be \( n \). The sum of the marks originally entered was \( 30.8n \).
After correcting the marks, the sum becomes \( 30.8n + 42 - 24 = 31.4n \). Solving the equation: \[ 30.8n + 18 = 31.4n \quad \Rightarrow \quad 18 = 0.6n \quad \Rightarrow \quad n = \frac{18}{0.6} = 30. \] Thus, the class has 30 students.