
Introduction
This is a Java-program to calculate the grade point average and the term's average for university students ...
This program has the ability to calculate the grade point average (GPA) and
the Term's Average from 4 or 5...
This is depend on your university or collage Rules..
You can choose the suite case for you "4 or 5" by the program...
This program is coded by: Mohammed alodib ..
there are to function to calculate grade if grade from 4 this function
public double calc_ave4(String mark,int hour) { double poi=0; if (mark=="A") poi=4 * hour; else if (mark=="B") poi=3 * hour; else if (mark=="C") poi=2 * hour; else if (mark=="D") poi=1 * hour; else if (mark=="H") poi= 0 * hour; return poi ; } |
if grafe from 5 this function
public double calc_ave5(String mark,int hour) { double poi=0; if (mark=="A+") poi=5 * hour; else if (mark=="A") poi=4.75 * hour; else if (mark=="B+") poi=4.5 * hour; else if (mark=="B") poi=4 * hour; else if (mark=="C+") poi=3.5 * hour; else if (mark=="C") poi=3 * hour; else if (mark=="D+") poi=2.5 * hour; else if (mark=="D") poi=2 * hour; else if (mark=="H") poi=1 * hour; return poi ; } |
this function to calculate Points:
public double calc_total_point(ComboBox a,TextBox th,int ord,int type_ave) { if (a.Text=="" && (a.Text !="" || th.Text!="")) MessageBox.Show("Insert Mark for Courses " + ord.ToString() ,"Note"); else if (th.Text=="" && (a.Text !="" || th.Text!="")) MessageBox.Show("Insert Hour for Courses "+ ord.ToString(),"NOTE"); else if (a.Text !="" && th.Text!="") { if (type_ave ==5) points=points + calc_ave5(a.Text.ToString(),int.Parse(th.Text.ToString())); else if (type_ave ==4) points=points + calc_ave4(a.Text.ToString(),int.Parse(th.Text.ToString())); hours_s=hours_s + int.Parse(th.Text.ToString()); } return 0;
} |
Now this button Calcate code:
double ave=0; points=0; hours_s=0; int type_ave=0; if (type5.Checked) type_ave=5; else type_ave=4; calc_total_point(ave1,hour1,1,type_ave); calc_total_point(ave2,hour2,2,type_ave); calc_total_point(ave3,hour3,3,type_ave); calc_total_point(ave4,hour4,4,type_ave); calc_total_point(ave5,hour5,5,type_ave); calc_total_point(ave6,hour6,6,type_ave); calc_total_point(ave7,hour7,7,type_ave);
if (points==0 && hours_s==0) ave=0; else ave=points/hours_s; if (points==0) points_l.Text="points= 0"; else points_l.Text="points= " + points.ToString("##.##"); hours_l.Text="hours= " + hours_s.ToString(); if (ave==0) result.Text="ave= 0"; else result.Text="ave= " + ave.ToString("##.##"); |
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here