-
Notifications
You must be signed in to change notification settings - Fork 0
/
student grade calculator.java
41 lines (38 loc) · 1.68 KB
/
student grade calculator.java
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
40
41
import java.util.Scanner ;
public class task2 {
public static void main(String[] args) {
System.out.println(" TASK 2 \n STUDENT GRADE CALCULATOR ");
System.out.println(" Class 12 - Higher Secondary Education \n Stream :- science ");
Scanner sc = new Scanner(System.in) ;
System.out.println("Enter your name ");
String name = sc.nextLine();
System.out.println("Enter marks of all subject out of 100 ");
System.out.println("Enter marks of maths : ");
double maths = sc.nextDouble() ; System.out.println("Enter marks of chemistry : ");
double chemistry = sc.nextDouble() ;
System.out.println("Enter marks of physics : ");
double physics = sc.nextDouble() ;
System.out.println("Enter marks of english : ");
double english = sc.nextDouble() ;
System.out.println("Enter marks of Information Practices : ");
double ip= sc.nextDouble() ;
double marks = maths+chemistry+physics+english+ip ;
double percentage = (marks / 500 ) * 100 ;
System.out.println(" your details & grades are as follow : \n" + name +"\n"+ marks +"\n"+ percentage );
if (percentage >= 80 ) {
System.out.println("your grade is A ");
}
else if (percentage >= 60 ) {
System.out.println("your grade is B ");
}
else if (percentage >= 40 ) {
System.out.println("your grade is B ");
}
else if (percentage >= 20 ) {
System.out.println("your grade is B ");
}
else {
System.out.println("your grade is E ");
}
}
}