Search the web
Sign In
New User? Sign Up
Java_Official · Java SE . EE . ME . AJAX . Web services
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
hi everyone   Message List  
Reply | Forward Message #31764 of 32218 |
can u tell me what is wrong with this cod

public void inputGrads()
{
Scanner in = new Scanner (System.in);

System.out.printf("%s\n%s\n,",
"enter the integer grade between 0 till 100",
"for ending the file press -1 and then enter");
total = 0;
gradcounter = 0;
grad = in.nextInt();
if (grad == -1)
System.out.println("there is no number");
else
{
while (grad != -1)
{
total += grad ;
gradcounter++;

System.out.println("enter ur nybmer");
grad = in.nextInt();

incrementLetterGradeCounter(grad );
}
}
//if (gradcounter == 0 )
// System.out.println("there was no number");
}

public void incrementLetterGradeCounter( int grad )
{
switch ( grad / 10)
{
case 9:
case 10:
++ acount;
break;

case 8:
++ bcount;
break;

case 7:
++ ccount;
break;

case 6:
++ dcount;
break;

default:
++ fcount;
break;
}
} //end of method

public void gradReport()
{
System.out.println(" the grads r:");

if( gradcounter != 0)
{
double average = (double) total/gradcounter;

System.out.printf(" total of the %d grade is %d\n ",
gradcounter,total);

System.out.printf(" the average of class is
%.2f\n",average);

System.out.printf("%s\n%s%d\n%s%d\n%s%d\n%s%d\n%s%d\n",
"number of student who received each grade",
"A:",acount,
"B:",bcount,
"C:",ccount,
"D:",dcount,
"F:",fcount);
}
else
System.out.print("there was no grad");

thanks
razieh





Thu Nov 27, 2008 3:07 pm

negar55375
Offline Offline
Send Email Send Email

Forward
Message #31764 of 32218 |
Expand Messages Author Sort by Date

can u tell me what is wrong with this cod public void inputGrads() { Scanner in = new Scanner (System.in); System.out.printf("%s\n%s\n,", "enter the integer...
negar55375
Offline Send Email
Nov 28, 2008
1:19 am

Please, be more specific. What is it supposed to do? What is it doing instead? Does it output any error message? The better your question the more likely...
Rodrigo Coin Curvo
rodrigoccurvo
Offline Send Email
Dec 2, 2008
5:15 am

Dear negar, Your code is in-complete. Without knowing complete code, its not possible to say whats wrong in the code. Regards Sreekanth G. ...
sreekanth gundagoni
sreekanth_aug16
Offline Send Email
Dec 5, 2008
1:24 am

As you using some statement like   System.out.printf(""); is supported only jdk-1.6. So you should check up your compiler first whether it is supported by...
Masudul Haque
masud_0504014
Offline Send Email
Dec 5, 2008
1:24 am

What output are you getting? Have you tried using a debugger, such as Eclipse? In short, what have you done to find the problem? -Java Guy...
Java Guy
mmjavaguy
Offline Send Email
Dec 5, 2008
1:24 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help