It is important to make them understand the seriousness of attending classes and how it will affect their future. The classes should also be more interesting. Try to discipline them without abusing or insulting them, which will make them resent the teacher and class even more.