calculate class