I need to calculate all the grade of all subject with theory and practical. by this code successfully calculated practical grade part, but in theory it only calculate upto 2.8 gp and grade C, How can I solve this problem? What's wrong here? Could someone please help me??
Code:
double th1, pr1, th2, pr2, th3, pr3, th4, pr4, th5, pr5, th6, pr6; th1 = Convert.ToDouble(txtth1.Text); th2 = Convert.ToDouble(txtth2.Text); th3 = Convert.ToDouble(txtth3.Text); th4 = Convert.ToDouble(txtth4.Text); th5 = Convert.ToDouble(txtth5.Text); th6 = Convert.ToDouble(txtth6.Text); pr1 = Convert.ToDouble(txtpr1.Text); pr2 = Convert.ToDouble(txtpr2.Text); pr3 = Convert.ToDouble(txtpr3.Text); pr4 = Convert.ToDouble(txtpr4.Text); pr5 = Convert.ToDouble(txtpr5.Text); pr6 = Convert.ToDouble(txtpr6.Text);
//Calculate grade point for theory// if (th1 <= 14.85 || th2 <= 14.85 || th3 <= 14.85 || th4 <= 14.85 || th5 <= 14.85 || th6 <= 14.85) { gp1.Text = "0.8"; grade1.Text = "E"; } else if (th1 <= 22.35 || th2 <= 22.35 || th3 <= 22.35 || th4 <= 22.35 || th5 <= 22.35 || th6 <= 22.35) { gp1.Text = "1.2"; grade1.Text = "D"; } else if (th1 <= 29.85 || th2 <= 29.85 || th3 <= 29.85 || th4 <= 29.85 || th5 <= 29.85 || th6 <= 29.85) { gp1.Text = "1.6"; grade1.Text = "D+"; } else if (th1 <= 37.35 || th2 <= 37.35 || th3 <= 37.35 || th4 <= 37.35 || th5 <= 37.35 || th6 <= 37.35) { gp1.Text = "2.0"; grade1.Text = "B"; } else if (th1 <= 44.85 || th2 <= 44.85 || th3 <= 44.85 || th4 <= 44.85 || th5 <= 44.85 || th6 <= 44.85) { gp1.Text = "2.4"; grade1.Text = "B+"; } else if (th1 <= 52.35 || th2 <= 52.35 || th3 <= 52.35 || th4 <= 52.35 || th5 <= 52.35 || th6 <= 52.35) { gp1.Text = "2.8"; grade1.Text = "C"; } else if (th1 >= 59.85 || th2 <= 59.85 || th3 <= 59.85 || th4 <= 59.85 || th5 <= 59.85 || th6 <= 59.85) { gp1.Text = "3.2"; grade1.Text = "C+"; } else if (th1 <= 67.35 || th2 <= 67.35 || th3 <= 67.35 || th4 <= 67.35 || th5 <= 67.35 || th6 <= 67.35) { gp1.Text = "3.6"; grade1.Text = "A"; } else if (th1 <= 75 || th2 <= 75 || th3 <= 75 || th4 <= 75 || th5 <= 75 || th6 <= 75) { gp1.Text = "4.0"; grade1.Text = "A+"; } //Calculate grade point for practical// if (pr1 <= 4.95 || pr2 <= 4.95 || pr3 <= 4.95 || pr4 <= 4.95 || pr5 <= 4.95 || pr6 <= 4.95) { p_gp1.Text = "0.8"; p_grade1.Text = "E"; } else if (pr1 <= 7.45 || pr2 <= 7.45 || pr3 <= 7.45 || pr4 <= 7.45 || pr5 <= 7.45 || pr6 <= 7.45) { p_gp1.Text = "1.2"; p_grade1.Text = "D"; } else if (pr1 <= 9.95 || pr2 <= 9.95 || pr3 <= 9.95 || pr4 <= 9.95 || pr5 <= 9.95 || pr6 <= 9.95) { p_gp1.Text = "1.6"; p_grade1.Text = "D+"; } else if (pr1 <= 12.45 || pr2 <= 12.45 || pr3 <= 12.45 || pr4 <= 12.45 || pr5 <= 12.45 || pr6 <= 12.45) { p_gp1.Text = "2.0"; p_grade1.Text = "B"; } else if (pr1 <= 14.95 || pr2 <= 14.95 || pr3 <= 14.95 || pr4 <= 14.95 || pr5 <= 14.95 || pr6 <= 14.95) { p_gp1.Text = "2.4"; p_grade1.Text = "B+"; } else if (pr1 <= 17.45 || pr2 <= 17.45 || pr3 <= 17.45 || pr4 <= 17.45 || pr5 <= 17.45 || pr6 <= 17.45) { p_gp1.Text = "2.8"; p_grade1.Text = "C"; } else if (pr1 <= 19.95 || pr2 <= 19.95 || pr3 <= 19.95 || pr4 <= 19.95 || pr5 <= 19.95 || pr6 <= 19.95) { p_gp1.Text = "3.2"; p_grade1.Text = "C+"; } else if (pr1 <= 22.45 || pr2 <= 22.45 || pr3 <= 22.45 || pr4 <= 22.45 || pr5 <= 22.45 || pr6 <= 22.45) { p_gp1.Text = "3.6"; p_grade1.Text = "A"; } else if (pr1 <= 25 || pr2 <= 25 || pr3 <= 25 || pr4 <= 25 || pr5 <= 25 || pr6 <= 25) { p_gp1.Text = "4.0"; p_grade1.Text = "A+"; }