private void Swap(ref GeneralMean generalMean1,ref GeneralMean generalMean2) { GeneralMean temp = generalMean1; generalMean1 = generalMean2; generalMean2 = temp; }
private decimal SearchForLowestMean(GeneralMean[] studAndMean) { decimal lowestMean = studAndMean[0].generalMean; for (int i = 0; i < studAndMean.Length-1; i++) { if (studAndMean[i].generalMean > studAndMean[i + 1].generalMean) lowestMean = studAndMean[i + 1].generalMean; }; return lowestMean; }
private GeneralMean[] SortStudAndGeneralMean(ref GeneralMean[] studAndGeneralMean) { for (int i = 0; i < studAndGeneralMean.Length-1; i++) { for (int j = i+1; j < studAndGeneralMean.Length; j++) { if (studAndGeneralMean[i].generalMean< studAndGeneralMean[j].generalMean) { Swap(ref studAndGeneralMean[i],ref studAndGeneralMean[j]); } } }; return studAndGeneralMean; }
private GeneralMean[] CreateStudAndGeneralMeanArray(Student[] allClass) { GeneralMean[] studAndGeneralMean = new GeneralMean[allClass.Length]; for (int i = 0; i < allClass.Length; i++) { studAndGeneralMean[i].name = allClass[i].name; studAndGeneralMean[i].generalMean = CalculateGeneralMean(allClass[i]); } return studAndGeneralMean; }