Solved

Grade conversion

Posted on 2008-06-21
6
475 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
  • 3
  • 3
6 Comments
 
LVL 100

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 100

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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:snakehead_diver
ID: 21859685
Stillgiving me this output;

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
linearIn  challenge 23 65
thread-safe code in c++ 2 72
Fibonacci challenge 11 84
parentbit challenge 3 52
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now