How to Make a Grade Maker in Java
Want to know your grade at school? It is really simple!
This article has been tagged as a stub. That means it's off to a good start, but still has room to grow into a more helpful resource. Until the article reaches its full potential, it will be hidden from search results. Can you help it flourish? If you think the article offers complete and accurate instructions, feel free to remove this tag. |
Steps
-
1Open a text editor or an IDE.
-
2Examine 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!
Self Defense?

relationships?

Drawing Household Objects?

Naruto Cosplay?

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.
About this wikiHow