• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sultan Aziz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
enter both, like this: 23 45
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic