Write a Java program Write a program that inputs total marks of a student, calculates the percentage (assuming total marks are 1100) and displays grade according to the following rules:
Percentage Grade
More than or equal to 80 A+
Between 70 (inclusive) and 80 A
Between 60 (inclusive) and 70 B
Between 50 (inclusive) and 60 C
Between 40 (inclusive) and 50 D
Between 33 (inclusive) and 40 E
Less than 33 F
Write full program. I will mark u as the brainliest.
Answers
Answer:
import java.util.*;
public class Program
{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t_marks;
float percentage;
System.out.println("Enter total marks of a student : ");
t_marks = sc.nextInt();
percentage = (t_marks*100)/1100;
if(percentage >= 80){
System.out.println("Grade = A+");
}
else if(percentage < 80 && percentage >= 70){
System.out.println("Grade = A");
}
else if(percentage < 70 && percentage >= 60){
System.out.println("Grade = B");
}
else if(percentage < 60 && percentage >= 50){
System.out.println("Grade = C");
}
else if(percentage < 50 && percentage >= 40){
System.out.println("Grade = D");
}
else if(percentage < 40 && percentage >= 33){
System.out.println("Grade = E");
}
else {
System.out.println("Grade = F");
}
}
}
Explanation: