aspose file tools*
The moose likes Beginning Java and the fly likes GPA Program ... Error Again....In  JCreator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GPA Program ... Error Again....In  JCreator" Watch "GPA Program ... Error Again....In  JCreator" New topic
Author

GPA Program ... Error Again....In JCreator

Sultan Aziz
Greenhorn

Joined: Feb 06, 2004
Posts: 4
hi,
Sorry, my English not very well...
I am using JCreator but when i Execute File it Not ask me to enter the second grade. that's a proplem.
class GPA{
public static void main(String args[]){
double sum=0;
int crd=0,i;
int m=3;
for(i=0;i<m;i++){
String g=(args[0]);
int c=Integer.parseInt(args[1]);
if(g.equals("A+")){
sum=sum+(4*c);
crd=crd+c;}

else if(g.equals("A")){
sum=sum+(3.75*c);
crd=crd+c;}

else if(g.equals("B+")){
sum=sum+(3.5*c);
crd=crd+c;}

else if(g.equals("B")){
sum=sum+(3*c);
crd=crd+c;}

else if(g.equals("C+")){
sum=sum+(2.5*c);
crd=crd+c;}

else if(g.equals("C")){
sum=sum+(2*c);
crd=crd+c;}

else if(g.equals("D+")){
sum=sum+(1.5*c);
crd=crd+c;}

else if(g.equals("D")){
sum=sum+(1*c);
crd=crd+c;}

else if(g.equals("F")){
sum=sum+(0*c);
crd=crd+c;}
else
System.out.println("Chek Your Grade");
}
System.out.println("Your GPA is "+(sum/crd));
}
}
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
enter both, like this: 23 45


java amateur
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: GPA Program ... Error Again....In JCreator