Write a Java program to display the grade of a student along with a student along with a message. The grade and the message to be displayed as per percentage are given above:
Create this program using the if-else if construct.
Please answer this question fast!
Answers
Answer:
the program for the question above using if..else if construct.
1. used package: util.Scanner;
import java.util.Scanner;
public class program
{
public static void main(String args[ ])
{
Scanner sc = new Scanner( System.in);
System.out.println("Enter student's name");
String name = sc.nextLine();
System.out.println("Enter the percentile of the student");
int per_centile = sc.nextInt();
if(per_centile> 90)
{
System.out.println(" grade : A+ ");
System.out.println(" Excellent Job");
}
else if(per_centile<90 || per_centile>80)
{
System.out.println(" grade : A");
System.out.println("Well done");
}
else if(per_centile< 80 || per_centile>70)
{
System.out.println(" grade : B");
System.out.println("Satisfactory performance");
}
else if( per_centile<70 || per_centile>60)
{
System.out.println(" grade C");
System.out.println("You can do better");
}
else if(per_centile<60 || per_centile>40)
{
System.out.println(" grade : D");
System.out.println("Performance needs improvement");
}
else
{
System.out.println(" grade : E");
System.out.println("You failed. Study hard");
}
} // main() close
} // class close
****I HOPE THIS HELPS****