Edit Article

Want to know your grade at school? It is really simple!



Steps

  1. 1
    Open a text editor or an IDE.
  2. 2
    Examine the Code. Try to understand the code, don't just copy and paste.
import java.util.Scanner;
 
public class Grader{
    public static void main(String[] args){
        Grader instance = new Grader();
        System.out.print("Enter your grade: ");
        Scanner input = new Scanner(System.in);
 
        try{
            int grade = Integer.parseInt(input.nextLine());
            instance.gradeMarks(grade);
        }catch(Exception e){
            System.err.println("This is not a number.");
        }
    }
 
    public void gradeMarks(int grade){
        String mark = "F";
 
        if(grade >= 90 && grade <= 100){
            mark = "A";
        }else if(grade >= 80 && grade <= 89){
            mark = "B";
        }else if(grade >= 70 && grade <= 79){
            mark = "C";
        }else if(grade >= 60 && grade <= 69){
            mark = "D";
        }
 
        System.out.printf("Your mark is %s.\n", mark);
    }
}

We could really use your help!

Can you tell us about
Self Defense?
Yes
No
Self Defense
how to defend yourself and make people afraid of you
how to defend yourself and make people afraid of you
Can you tell us about
relationships?
Yes
No
relationships
how to make a guy feel special
how to make a guy feel special
Can you tell us about
Drawing Household Objects?
Yes
No
Drawing Household Objects
how to draw a piano
how to draw a piano
Can you tell us about
Naruto Cosplay?
Yes
No
Naruto Cosplay
how to run like Naruto
how to run like Naruto
Thanks for helping! Please tell us everything you know about
...
Tell us everything you know here. Remember, more detail is better.
Tips
Provide Details.
Please be as detailed as possible in your explanation. Don't worry about formatting! We'll take care of it. For example:
Don't say: Eat more fats.
Do say: Add fats with some nutritional value to the foods you already eat. Try olive oil, butter, avocado, and mayonnaise.

Things You'll Need

  • A computer
  • Java compiler
  • Text editor and/or an IDE.

Tip

  • As mentioned above, if you want to learn Java language, you shouldn't just copy and paste the code, you should try to understand what each line does.

Article Info

Categories: Stub | Java

Thanks to all authors for creating a page that has been read 2,821 times.

Did this article help you?
Yes No