Solved

Grade conversion

Posted on 2008-06-21
6
483 Views
Last Modified: 2010-04-21
I would like to create a java code that converts students numeric grades to a letter grade.
90 to 100 is A; 80 to 89 is B; 70 to 70 is C; 60 to 69 is D else is F
example target output:
Name: John
Score: 89
Grade: B

Name: Rob
Score: 95
Grade: A
 
and so on...
0
Comment
Question by:snakehead_diver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 21850288
This reads like a school exercise?  If so EE cannot do your work for you but rther can help with specific problems and help you reach a solution.

What code do you have thus far?

mlmcc
0
 

Author Comment

by:snakehead_diver
ID: 21853161
I am trying to create a simple JAVA code but is not looping the way I expect itto loop.

the code is

while (true)
{
   System.out.print("Enter student name:  ")
   name = scan.nextLine();
   if ( name.equalsIgnoreCase("quit")) break;
   System.out.print("Enter score:  ");
   num = scan.nextInt();
     if (num >= 90)
     System.out.println("Student score is A")
}
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 250 total points
ID: 21857536
You might try it like this

System.out.print("Enter student name:  ")
name = scan.nextLine();
while not  (name.equalsIgnoreCase("quit"))
{
   System.out.print("Enter score:  ");
   num = scan.nextInt();
   if (num >= 90)
         System.out.println("Student score is A")
   else if (num >= 80)
         System.out.println("Student score is B")
   else if (num >= 70)
         System.out.println("Student score is C")
   else if (num >= 60)
         System.out.println("Student score is D")
   else
         System.out.println("Student score is F");
    System.out.print("Enter student name:  ")
    name = scan.nextLine();
}

mlmcc
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:snakehead_diver
ID: 21859685
Stillgiving me this output;

Name: Rob
Score: 95
Grade: AEnter score:
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 21859798
The way you have it that is what you will get.  

Your output doesn't match the code in either my example or yours.  Can you cut and paste the exact code.

What result do you want.

mlmcc
0
 

Author Closing Comment

by:snakehead_diver
ID: 31469391
mlmcc - Thanks for your solution. It helps a lot for a beginner like me.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Six Sigma Control Plans

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question