program to calculate grade of the student – java

//program to calculate grade of the student.
class Grade
{
public static void main(String ar[])
{
int max=100,t=0;
float a=82,b=71,c=76,sum=0,per=0;
if((a>max)||(b>max)||(c>max))
System.out.println(“\n\t!!Wrong data !!\nThe obtained marks should not exceed the maximum marks.”);
else
{
t=max*3;
sum=a+b+c;
per=(sum/t)*100;
System.out.println(“******RESULT******”);
System.out.println(“Maximum marks : “+t);
System.out.println(“Obtained marks: “+sum);
System.out.println(“Percentage    : “+per);
if(per>=80)
System.out.println(“Grade : A”);
else if((per>=60)&&(per<80))
System.out.println(“Grade : B”);
else if((per>=40)&&(per<60))
System.out.println(“Grade : C”);
else
System.out.println(“Result : Fail”);
}
}
}

Leave a Reply

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