Program to print grade of a student

Program to print grade of a student

Program to print grade of a student

This program helps the user to enter five different integer values for five subjects. Next, it finds the Total and Percentage of those Five Subjects.
For this, we are using the Arithmetic Operators to perform arithmetic operations. Next, we used the Else If statement to display the Grade.

importjava.util.Scanner;
public class StudentGrade {
    private static Scanner sc;
    public static void main(String[] args) 
    {
        int Networking, C, DAA, Artificial Intelligence, Android, Python; 
        float total, Percentage;
        sc = new Scanner(System.in);	
        System.out.print(" Please Enter the Six Subjects Marks : ");
        Networking = sc.nextInt();	
        C = sc.nextInt();	
        DAA = sc.nextInt();	
        Artificial Intelligence = sc.nextInt();	
        Android = sc.nextInt();	
                            Python = sc.nextInt();
        total = Networking+ C+DAA+ Artificial Intelligence+ Android,+Python;
        Percentage = (total / 600) * 100;
        System.out.println(" Total Marks =  " + total);
        System.out.println(" Marks Percentage =  " + Percentage);	
        if(Percentage >= 90)
        {
            System.out.println("\n Grade A");
        }
        else if(Percentage >= 80)
        {
            System.out.println("\n Grade B");
        }
        else if(Percentage >= 70)
        {
            System.out.println("\n Grade C");
        }
        else if(Percentage >= 60)
        {
            System.out.println("\n Grade D");
        }
        else if(Percentage >= 40)
        {
            System.out.println("\n Grade E");
        }
        else 
        {
            System.out.println("\n Fail");
        } 
    }
}

Program Output:

Please Enter the Six Subjects Marks :  70  85  79  80  92  87
Total Marks =  493
Marks Percentage =  82.166
Grade  A

I hope this post helps you to understand and Print grade of a student and its implementation in Java programming language.

Keep coding 🙂

2 thoughts on “Program to print grade of a student”

Leave a Reply

Your email address will not be published. Required fields are marked *