Java Program to Find Students Grades using Switch Case

In this tutorial you will learn about the Java Program to Find Students Grades using Switch Case and its application with practical example.

In this tutorial, we will learn to create a Java program to Find students Grade using Switch Case using Java programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following Java programming topics:

  • Java Operators.
  • Basic Input and Output
  • Class and Object.
  • Basic Java programming.
  • if-else statements.
  • Switch case.
  • Nested if-else Statements.
  • Java Scanner class.

Grade of a Student.

Here we are going to write a Java program to find out students grades using switch case statement. The Table shows the grading system.

       Score                 

                        Grade

       Grade >=90                                                  A
       Grade=80-89                                                  B
       Grade=70-79                                                   C
       Grade=60-69                                                    D
       Grade=50-59                                                     E
        Grade <50                                                      F

 

Java Program to Find Students Grades using Switch Case

In this our program we will create a program to find Student Grades using Switch Case. We would first declared and initialized the required variables. Next, we would prompt user to input value.Later in the program we will find Garde.

Output

Your Grade

In the above program, we have first declared and initialized a set variables required in the program.

  • score =it will  holds value of score given by user.
  • Grade= it will provide grade of given score.

In the next statement user will be prompted to enter the score then we will find the Grade according to score given bye user.

Now,we calculated the grade.Grades must be calculated based on following conditions.
Shown in above table using Switch Case as shown in image below.

In our program, we did not use the break statement. Whenever the condition is satisfied value is returned and the control came back to the main method. and according to return value we will print Grade to given score.

In this tutorial we have learn about the Java Program to Find Students Grades using Switch Case and its application with practical example. I hope you will like this tutorial.