-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGrades_method.java
More file actions
39 lines (36 loc) · 1.12 KB
/
Grades_method.java
File metadata and controls
39 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import java.util.Scanner;
public class Grades_method {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter Marks: ");
int marks = scan.nextInt();
grade(marks);
}
static void grade(int marks) {
String grade = null;
if(marks<=100){
if(marks>90&&marks<=100){
grade="AA";
}
else if(marks>80&&marks<=90){
grade="AB";
}
else if(marks>70&&marks<=80){
grade="BB";
} else if(marks>60&&marks<=70){
grade="BC";
} else if(marks>50&&marks<=60){
grade="CD";
} else if(marks>40&&marks<=50){
grade="DD";
}
else if(marks<=40){
grade="Fail";
}
}
else{
System.out.println("Enter correct Marks Please!!");
}
System.out.println("Grade of Student is: "+grade);
}
}