Thursday, 16 May 2013

Student Exam Grade System

This is the Tested code for the Student Exam System to Find the Appropriate Grade for the Given Marks Using the Code Java and IDE http://netbeans.org

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package salarytax;

import java.util.Scanner;

/**
*
* @author saeed
*/
public class GradeSystem {
public static void main(String args[]){
int[] marks = new int[5];
int sum=0;
String grade="null";
Scanner scan=new Scanner(System.in);
//Read Data
for(int i=0;i<marks.length;i++){
System.out.print("Enter the Marks for Subject # "+(i+1)+"___");
marks[i]=scan.nextInt();
sum=sum+marks[i];
}
double per=(double)sum/500*100;
if(per<33){
grade="Fail";
}else if((per>=33)&&(per<50)){
grade="D Grade";
}else if((per>=50)&&(per<60)){
grade="C Grade";
}else if((per>=60)&&(per<70)){
grade="B Grade";
}else if((per>=70)&&(per<80)){
grade="A Grade";
}else if((per>=80)&&(per<90)){
grade="A+ Grade";
}else if(per>=90){
grade="Cheater Kute";
}
System.out.println("\nYour Total Marks "+sum);
System.out.println("Your Average "+per);
System.out.println("Your are "+grade);

}
}

No comments:

Post a Comment