Click here to Skip to main content
Licence 
First Posted 18 Aug 2004
Views 34,238
Bookmarked 9 times

Calucate average in Pocket PC

By | 18 Aug 2004 | Article
This is a Java-program to calculate the grade point average and the term's average
  • <A href="Pocket_pc_average/average.zip">Download source files - 24 Kb</A> 

Sample Image - Pocket_pc_average.gif

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("##.##");

License

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

About the Author

mohammed alodib



Saudi Arabia Saudi Arabia

Member

bachelor's computer science
programmer in:
C#
C++
Asp.NET
Oracle
==================
from Saudi Arabia

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralMy vote of 1 Pinmembercinamon15:07 1 Feb '09  
GeneralDelete it Pinmembermabdulfatah8:39 21 Aug '04  
GeneralWhat's a Calucate Pinmemberedricoh6:02 20 Aug '04  
GeneralIterate man, iterate PinmemberColin Angus Mackay23:05 19 Aug '04  
GeneralRe: Iterate man, iterate Pinmembermohammed alodib7:24 20 Aug '04  
GeneralWTF... PinmemberDavid M. Kean22:37 19 Aug '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web02 | 2.5.120517.1 | Last Updated 19 Aug 2004
Article Copyright 2004 by mohammed alodib
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid