469,364 Members | 2,346 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,364 developers. It's quick & easy.

writing a java program

a program that expects a numeric grade as input and outputs the corresponding letter grade. the program uses the following grading scale:
numeric range letter grade
0 39 E
40 49 D
50 56 C
57 63 C+
64 70 B
71 77 B+
78 84 A
85 100 A+

required to use compound boolean operators
Sep 3 '07 #1
5 3743
Nepomuk
3,112 Expert 2GB
a program that expects a numeric grade as input and outputs the corresponding letter grade. the program uses the following grading scale:
numeric range letter grade
0 39 E
40 49 D
50 56 C
57 63 C+
64 70 B
71 77 B+
78 84 A
85 100 A+

required to use compound boolean operators
Hi Arishma! Welcome to TSDN!
Check out the java.util.Scanner class for reading in your numeric value and then find the correct Letter for it. If you're new to Java, check out this article - it will teach you, what you have to know to solve this problem.

Greetings,
Nepomuk
Sep 3 '07 #2
nickyeng
254 100+
hi,

why not you give some code that you've done to show us what you've got so far..

but you seems like asking ppl giving you the code...

:p

from
Nick.
Sep 4 '07 #3
Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. class testscore {
  3.     public static void main(String[] args) {
  4.  
  5.         int testscore;
  6.         char Grade;
  7.              char Grade;//To print the student grade on the screen
  8.  
  9.        if (testscore >=0 && testscore <= 39) 
  10.             System.out.println( "E" ) ; 
  11.          if (testscore >= 40 && testscore <= 49)
  12.             System.out.println( "D" ) ;
  13.         if (testscore >= 50 && testscore <=56) 
  14.             System.out.println( "C" ) ;
  15.          if (testscore >= 57 && testscore <=63)
  16.             System.out.println( "C+" ) ;
  17.         if (testscore >=64 && testscore <= 70)
  18.             System.out.println( "B" ) ;
  19.       if (testscore >=71 && testscore <= 77)
  20.         System.out.println( "B+" ) ;
  21.       if (testscore >=78 && testscore <= 84)
  22.            System.out.println( "A" ) ;
  23.      if (testscore >= 85 && testscore <= 100)  
  24.         System.out.println( "A+" ) ;
  25.  
  26.  
  27.         return Grade;//method to return student grade                    
  28.                        }
  29.  
  30. }
  31.  
this is what i have got but 1 error where help pliz
Sep 6 '07 #4
thanx a ton i think i have got it now
Sep 6 '07 #5
Nepomuk
3,112 Expert 2GB
thanx a ton i think i have got it now
Well done for finding it!

One little tip:
When you ask for help next time, don't just state, that there is an error, but also tell us, what error it is (what it is called, e.g. NullPointerException, IOException, ...) and in what line it occurs (the compiler will write something like
Expand|Select|Wrap|Line Numbers
  1. Exception in thread "main" java.lang.NullPointerException
  2.     at java.io.FileInputStream.<init>(Unknown Source)
  3.     at yourProject.yourClass.main(Exceptions.java:12)
  4.  
and then 12 would be the line you're looking at).

Greetings,
Nepomuk
Sep 6 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by SomeDude | last post: by
1 post views Thread by GM | last post: by
48 posts views Thread by Joseph | last post: by
12 posts views Thread by Von Clubusev | last post: by
2 posts views Thread by Luc The Perverse | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.