# Thread: Using java to determine a letter grade with any given number 0-100

1. Member
Join Date
Oct 2015
Posts
2
Rep Power
0

## Using java to determine a letter grade with any given number 0-100

Okay so I am trying to create a class that can determine your letter grade (a,b,c,d,f) with a given number between 0-100.
The grade scale I am using is as follows:

A is >= 90
B is >= 80 and <90
C is >= 75 and <80
D is >= 70 and <75
F is <70

And here is what I have so far:
Java Code:
```import static java.lang.System.*;

{
public Grade(int a, int b, int c, int d, int f)
{
}
public void setGrade (int a, int b, int c, int d, int f)
{
}
}```
and the runner class:
Java Code:
```import static java.lang.System.*;

import java.util.Scanner;

{

public static void main( String[] args )

{

Scanner keyboard = new Scanner(System.in);

out.print("Enter a number grade :: ");

out.print("Enter a number grade :: ");

out.print("Enter a number grade :: ");

out.print("Enter a number grade :: ");

}

}```
So currently when compiled as is (and it is far from done) I get the error "illegal start of expression" in public void setGrade. I'm not to sure what to do next so any guidance and/or help on the matter would be greatly appreciated! Thanks!

2. Senior Member
Join Date
Jan 2013
Location
Northern Virginia, United States
Posts
6,226
Rep Power
14

## Re: Using java to determine a letter grade with any given number 0-100

Your expressions in lines 16-20 are not valid (in fact, I am not certain how you arrived at that syntax). Here is an example of how you might do it:

Java Code:
```if (grade >= 80 && grade < 90) {
}```
You may want to review the tutorials in my signature.

Regards,
Jim

3. Senior Member
Join Date
Sep 2014
Location
MA, USA
Posts
399
Rep Power
6

## Re: Using java to determine a letter grade with any given number 0-100

why do you pass 5 integers into the Grade constructor? how does that relate to the instantiation in your runner class? I also have a feeling that there are numerous variables that haven't been declared in your code. what happens to results of more than 90 points?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•