diff --git a/ZC-GPA Calculator/AddSemesterForm.cs b/ZC-GPA Calculator/AddSemesterForm.cs index a3b2c9a..51dbfed 100644 --- a/ZC-GPA Calculator/AddSemesterForm.cs +++ b/ZC-GPA Calculator/AddSemesterForm.cs @@ -24,7 +24,7 @@ private void AddSemesterForm_Load(object sender, EventArgs e) private void addSemesterBtn_Click(object sender, EventArgs e) { - SemesterTitle = (Semester)Enum.Parse(typeof(Semester) ,this.semesterComboBox.Text); + SemesterTitle = (Semester)Enum.Parse(typeof(Semester), this.semesterComboBox.Text); SemesterYear = this.yearDatePicker.Value.Year; this.DialogResult = DialogResult.OK; } diff --git a/ZC-GPA Calculator/Defs.cs b/ZC-GPA Calculator/Defs.cs index 49cc482..6ab823c 100644 --- a/ZC-GPA Calculator/Defs.cs +++ b/ZC-GPA Calculator/Defs.cs @@ -13,21 +13,4 @@ public enum NonGPAGrades : byte WF, TR, }; - - // repeated courses - - /* - Attempted Hours: - Attempted hours are defined as all hours accumulated throughout a student's career at an institution - (including all passed courses, failed courses, repeated courses, courses dropped after drop-add period, summer courses and transfer work). - - Note: Hours currently in progress are not calculated in attempted hours - - Earned Hours: - Earned hours are defined as credits attained from all courses (including transfer work, AP classes and summer courses) - a student has successfully passed. Withdrawals and failed courses do not count as earned hours. - - - Note: Hours currently in progress are not calculated in earned hours - */ } diff --git a/ZC-GPA Calculator/Form1.cs b/ZC-GPA Calculator/Form1.cs index db81636..9ff4132 100644 --- a/ZC-GPA Calculator/Form1.cs +++ b/ZC-GPA Calculator/Form1.cs @@ -1,6 +1,5 @@ using System.ComponentModel; using System.Diagnostics; -using System.Security.Policy; namespace ZC_GPA_Calculator { @@ -31,7 +30,7 @@ private void browseFileBtn_Click(object sender, EventArgs e) if (openFileDialog.ShowDialog() == DialogResult.OK) { - string filePath = openFileDialog.FileName; //files path + string filePath = openFileDialog.FileName; readInputFile(filePath); } } @@ -89,7 +88,7 @@ private void addNewSemester(Semester semesterTitle, int year, BindingList letterGrades; - static int maxVisibleCourses = 6; + const int maxVisibleCourses = 6; public string SemesterTitle { get => semesterTitle.Text; set => semesterTitle.Text = value; } public bool AllowAdding { get => allowAdding; set => allowAdding = value; } @@ -17,7 +17,6 @@ public SemesterCard() InitializeComponent(); letterGrades = new BindingList { "A", "A-", "B+", "B", "B-", "C+", "C", "C-", "F" }; this.grade.DataSource = letterGrades; - } private void SemesterCard_Load(object sender, EventArgs e) { @@ -116,6 +115,12 @@ public void updateGPACalculationsTable(BindingList semesters, int inde // GPA Calculations calculationsTable.Rows[0].Cells["GPACredits"].Value = semesters[index].calculateGPACredits().ToString(); calculationsTable.Rows[1].Cells["GPACredits"].Value = semester.calculateOverallGPACredits(semesters, index).ToString(); + calculationsTable.Rows[0].Cells["AttemptedCredits"].Value = semesters[index].calculateAttemptedCredits().ToString(); + calculationsTable.Rows[1].Cells["AttemptedCredits"].Value = semester.calculateOverallAttemptedCredits(semesters, index).ToString(); + calculationsTable.Rows[0].Cells["EarnedCredits"].Value = semesters[index].calculateEarnedCredits().ToString(); + calculationsTable.Rows[1].Cells["EarnedCredits"].Value = semester.calculateOverallEarnedCredits(semesters, index).ToString(); + calculationsTable.Rows[0].Cells["TotalCredits"].Value = semesters[index].calculateTotalCredits().ToString(); + calculationsTable.Rows[1].Cells["TotalCredits"].Value = semester.calculateOverallTotalCredits(semesters, index).ToString(); calculationsTable.Rows[0].Cells["TransferCredits"].Value = semesters[index].calculateTransferCredits().ToString(); calculationsTable.Rows[1].Cells["TransferCredits"].Value = semester.calculateOverallTransferCredits(semesters, index).ToString(); calculationsTable.Rows[0].Cells["Quality_Points"].Value = semesters[index].calculateQualityPoints().ToString("0.00"); diff --git a/ZC-GPA Calculator/Utilities.cs b/ZC-GPA Calculator/Utilities.cs index c9ab173..5ec6965 100644 --- a/ZC-GPA Calculator/Utilities.cs +++ b/ZC-GPA Calculator/Utilities.cs @@ -3,7 +3,6 @@ //using iTextSharp.text.pdf.parser; using System.Net; using System.ComponentModel; -using System; namespace ZC_GPA_Calculator { @@ -130,7 +129,6 @@ public static void changeRepeatedFlag(string courseCode, BindingList s { MessageBox.Show($"It seems that the repeated course, {courseCode}, was repeated with different corse code. Reach the old course and change its grade to 'P', please!"); } - } public static void changeRepeatedFlag2(string courseCode, BindingList semestersList) { diff --git a/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.dll b/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.dll index eddae36..fe17897 100644 Binary files a/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.dll and b/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.dll differ diff --git a/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.pdb b/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.pdb index fee3a77..8dc0fe8 100644 Binary files a/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.pdb and b/ZC-GPA Calculator/bin/Debug/net7.0-windows/ZC-GPA Calculator.pdb differ diff --git a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.dll b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.dll index eddae36..fe17897 100644 Binary files a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.dll and b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.dll differ diff --git a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.pdb b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.pdb index fee3a77..8dc0fe8 100644 Binary files a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.pdb and b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ZC-GPA Calculator.pdb differ diff --git a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ref/ZC-GPA Calculator.dll b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ref/ZC-GPA Calculator.dll index f3a984f..eeb4cc1 100644 Binary files a/ZC-GPA Calculator/obj/Debug/net7.0-windows/ref/ZC-GPA Calculator.dll and b/ZC-GPA Calculator/obj/Debug/net7.0-windows/ref/ZC-GPA Calculator.dll differ diff --git a/ZC-GPA Calculator/obj/Debug/net7.0-windows/refint/ZC-GPA Calculator.dll b/ZC-GPA Calculator/obj/Debug/net7.0-windows/refint/ZC-GPA Calculator.dll index f3a984f..eeb4cc1 100644 Binary files a/ZC-GPA Calculator/obj/Debug/net7.0-windows/refint/ZC-GPA Calculator.dll and b/ZC-GPA Calculator/obj/Debug/net7.0-windows/refint/ZC-GPA Calculator.dll differ diff --git a/ZC-GPA Calculator/semester.cs b/ZC-GPA Calculator/semester.cs index aa8628d..3109181 100644 --- a/ZC-GPA Calculator/semester.cs +++ b/ZC-GPA Calculator/semester.cs @@ -1,4 +1,5 @@ using System.ComponentModel; +using System.Diagnostics; namespace ZC_GPA_Calculator @@ -70,7 +71,9 @@ public double calculateEarnedCredits() double _credits = 0; foreach (var course in this.courses) { - if (course.Grade != "IP" && course.Grade != "" &&) + //if ((course.Grade == "A" || course.Grade == "A-" || course.Grade == "B+" || course.Grade == "B" || course.Grade == "B-" || course.Grade == "C+" || course.Grade == "C" || course.Grade == "C-" || course.Grade == "P" || course.Grade == "TR") && course.RepeatedIn == -1) + // === + if ((course.GpaCredits != 0 || course.Grade == "P" || course.Grade == "TR") && course.RepeatedIn == -1) _credits += course.Credits; } return _credits; @@ -78,17 +81,37 @@ public double calculateEarnedCredits() public static double calculateOverallEarnedCredits(BindingList semesters, int index) { double _overallCredits = 0; - for (int i = 0; i <= index; i++) { foreach (var course in semesters[i].Courses) { - if (course.Grade != "IP") + if ((course.GpaCredits != 0 || course.Grade == "P" || course.Grade == "TR") && course.RepeatedIn == -1) _overallCredits += course.Credits; } } return _overallCredits; } + public double calculateTotalCredits() + { + double _credits = 0; + foreach (var course in this.courses) + { + _credits += course.Credits; + } + return _credits; + } + public static double calculateOverallTotalCredits(BindingList semesters, int index) + { + double _overallCredits = 0; + for (int i = 0; i <= index; i++) + { + foreach (var course in semesters[i].Courses) + { + _overallCredits += course.Credits; + } + } + return _overallCredits; + } public double calculateTransferCredits() { double _credits = 0;