You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the file Grade.cs, add a method for grade prediction using the complete grades list.
Class: AcademicHistory
For the function, Return expected: GPA, CGPA, Credits completed, total credits (after prediction) Input arguments: List of pairs of (course and grade), current AcademicHistory.
Incorporate all cases such as arrear, re-registration etc. Refer to the code snippet below for suggestions:
privateasyncvoidCalculateButton_Click(objectsender,RoutedEventArgse){doubleweighedSum=0;ushortnormalisingCredits=0;ushortcreditsEarnedNow=0;foreach(CourseGradePaircgPairinCourseGradePairs){if(!char.IsLetter(cgPair.Grade)){// throw exception instead for invalid argumentsawaitnewMessageDialog("Please enter grade predictions for all courses to calculate the GPA.","Missing Inputs").ShowAsync();return;}if(cgPair.Grade=='N')continue;normalisingCredits+=cgPair.Credits;if(cgPair.Grade=='F')continue;weighedSum+=cgPair.Credits*GetGradePoint(cgPair.Grade);creditsEarnedNow+=cgPair.Credits;}ushortcreditsRegisteredNow=UserManager.CurrentUser.CoursesMetadata.TotalCredits;ushortcreditsEarned=GradeHistory.CreditsEarned;ushortcreditsRegistered=GradeHistory.CreditsRegistered;doublegpa=weighedSum/normalisingCredits;doublecgpa=(weighedSum+GradeHistory.Cgpa*creditsRegistered)/(creditsRegistered+creditsRegisteredNow);PredictedGpa=gpa.ToString("F2");PredictedCgpa=cgpa.ToString("F2");PredictedCredits=newushort[4]{creditsEarnedNow,creditsRegisteredNow,(ushort)(creditsEarned+creditsEarnedNow),(ushort)(creditsRegistered+creditsRegisteredNow)};}privateushortGetGradePoint(chargrade){switch(grade){case'S':return10;case'A':return9;case'B':return8;case'C':return7;case'D':return6;case'E':return5;default:return0;}}
P.S. This code has a few bugs, but anyways can implement this for a first try perhaps.
Also, adhere to the naming conventions as described here!
The text was updated successfully, but these errors were encountered:
In the file Grade.cs, add a method for grade prediction using the complete grades list.
Class:
AcademicHistory
For the function,
Return expected: GPA, CGPA, Credits completed, total credits (after prediction)
Input arguments: List of pairs of (course and grade), current
AcademicHistory
.Incorporate all cases such as arrear, re-registration etc. Refer to the code snippet below for suggestions:
P.S. This code has a few bugs, but anyways can implement this for a first try perhaps.
Also, adhere to the naming conventions as described here!
The text was updated successfully, but these errors were encountered: