Software Engineering 2016.6.29 Daily
Today, my main work is to investigate and understand our school's weighted average division calculation method, and the program weighted calculation part to be corrected.
To obtain information by consulting the public Educational administration of North Engineering:
Tenth articleThe school uses the "credit pass rate" and "weighted average score" as the main indicators to measure students ' learning quality during school. Secondary courses, innovative credits and second-class credits and grades are not counted toward the credit pass rate and the weighted average score. Chongnew credits and second class are necessary for students to qualify for graduation. Students majoring in science and engineering should be repaired not less than4credits of innovative credits, other professions should be repaired not less than2credits for innovative credits. The second class should be completed Acredits.
At the same time, by asking the students to obtain in the administration of education in the curriculum of the expression:
In the site data, there is a minor mark column, which is labeled 2 means a minor course.
In addition, according to the classmate's reflection, for the failure of the subject, is not calculated in the weighted average score, so it is necessary to do not pass the subject of the treatment.
According to the data of the survey, the calculation logic of the weighted average fractional part is modified, because the data crawl part does not crawl the secondary curriculum mark, so it is not possible to modify this aspect temporarily. But the creative credits course and the second classroom course are excluded from the code logic. This is the work that is done today.
The following is the modified code logic:
1 #regionWeighted average score--------------------calculated2 /// <summary>3 ///calculate weighted average score4 /// </summary>5 /// <param name= "Calculatedata" >List of filtered scores</param>6 /// <param name= "Weightedmean" >Weighted average score</param>7 /// <returns>whether the calculation was successful</returns>8 Public Static BOOLCalculateweightedmean (DataTable Calculatedata, out DoubleWeightedmean)9 {Ten //if the input data table is empty, it is not counted. One if(CalculateData.Rows.Count = =0) A { -Weightedmean =0; -MessageBox.Show ("[Error]no data to calculate weighted mean."); the //Console.WriteLine ("[Error]no data to calculate weighted mean."); - return false; - } - + Try - { + //Calculate credits and grades * credits and A DoubleSumofcredit =0, Sumofgrade =0; at foreach(DataRow Drinchcalculatedata.rows) - { - //If the score is a number and is not a second class course, calculate the weighted - if(Regex.IsMatch (Convert.ToString (dr["Achievements"]), pattern) &&! Convert.ToString (dr["Course Nature"]). Equals ("School Elective") && Convert.ToInt32 (dr["Achievements"]) >= -) - { -Sumofcredit + = convert.todouble (dr["credits"]); inSumofgrade + = convert.todouble (dr["Achievements"]) * Convert.todouble (dr["credits"]); - } to + } -Weightedmean = Sumofgrade/Sumofcredit; the return true; * } $ Catch(Exception e)Panax Notoginseng { -Weightedmean =-1; theMessageBox.Show ("{0}", e.message); + //Console.WriteLine ("{0}", e.message); A return false; the } + } - #endregion
Software Engineering 2016.6.29 Daily