You can fail the classes as many times as you want. Every time you complete one you move to the next level of 5 levels of each class. Everytime you complete a class you get an upgrade. Classes are not even required at all in the game except for the first chemistry class because it's in a mission.