Example #1
0
float Team::getQualVariance(QHash<QString, float>& avgs){
    //temporary summing variables
    float temp_att_2404 = 0;
    float temp_att_3005 = 0;
    float temp_att_coding = 0;
    float temp_att_dbase = 0;
    float temp_att_selfDir = 0;
    float temp_att_writing = 0;
    float temp_att_UI = 0;
    float temp_att_algorithm = 0;
    float temp_att_present = 0;
    float temp_att_teamwork = 0;
    float temp_att_experience = 0;
    float temp_att_testing = 0;
    float temp_att_UML = 0;
    float temp_att_req = 0;
    float temp_att_reliable = 0;
    float temp_att_comm = 0;
    float temp_att_respect = 0;
    float temp_att_creative = 0;
    float temp_att_critic = 0;

    float ret = 0;

    //for each student in team:
    // find the difference between each qaulification and the class average
    // square it
    // add it to the temporary summing variable
    Student* s;
    foreach(s, students){

        temp_att_2404 += square((float)s->getAtt_2404() - (float)avgs["att_2404"]);
        temp_att_3005 += square((float)s->getAtt_3005() - (float)avgs["att_3005"]);
        temp_att_coding += square((float)s->getAtt_coding() - (float)avgs["att_coding"]);
        temp_att_dbase += square((float)s->getAtt_dbase() - (float)avgs["att_dbase"]);
        temp_att_selfDir += square((float)s->getAtt_selfDir() - (float)avgs["att_selfDir"]);
        temp_att_writing += square((float)s->getAtt_writing() - (float)avgs["att_writing"]);
        temp_att_UI += square((float)s->getAtt_UI() - (float)avgs["att_UI"]);
        temp_att_algorithm += square((float)s->getAtt_algorithm() - (float)avgs["att_algorithm"]);
        temp_att_present += square((float)s->getAtt_present() - (float)avgs["att_present"]);
        temp_att_teamwork += square((float)s->getAtt_teamwork() - (float)avgs["att_teamwork"]);
        temp_att_experience += square((float)s->getAtt_experience() - (float)avgs["att_experience"]);
        temp_att_testing += square((float)s->getAtt_testing() - (float)avgs["att_testing"]);
        temp_att_UML += square((float)s->getAtt_UML() - (float)avgs["att_UML"]);
        temp_att_req += square((float)s->getAtt_req() - (float)avgs["att_req"]);
        temp_att_reliable += square((float)s->getAtt_reliable() - (float)avgs["att_reliable"]);
        temp_att_comm += square((float)s->getAtt_comm() - (float)avgs["att_comm"]);
        temp_att_respect += square((float)s->getAtt_respect() - (float)avgs["att_respect"]);
        temp_att_creative += square((float)s->getAtt_creative() - (float)avgs["att_creative"]);
        temp_att_critic += square((float)s->getAtt_critic() - (float)avgs["att_critic"]);
    }