public class TestMain {
public static void main(String[] args) {
displayTitle();
while(true){
int s = getExam();
String info = determineGrade(s);
showMessage(info);
}
}
public static void displayTitle(){
System.out.println("Grade Classifier");
System.out.println("****************\n");
}
public static int getExam(){
Scanner sc = new Scanner(System.in);
System.out.print("Enter exam mark:> ");
return sc.nextInt();
}
public static String determineGrade(int score){
String g;
if(score>=70 && score<=100){
g = "Congratulations,you are awarded a Grade A Pass.";
}else if(score>=60 && score<=69){
g = "Congratulations,you are awarded a Grade B Pass.";
}else if(score>=50 && score<=59){
g = "Congratulations,you are awarded a Grade C Pass.";
}else if(score>=40 && score<=49){
g = "Congratulations,you are awarded a Grade D Pass.";
}else{
g = "Unfortunately,you are awarded a Grade F Fail.";
}
return g;
}
public static void showMessage(String g){
System.out.println(g);
}
}