Using Java with the selection statement ,create a class with grade students to accept the score of a student and determine the grade thus 85-100=A+,80-84+A,75-79=B+,70-74=B,65-69=C+,60-64=C,55-59=D+,50-54=D,Below
import java.util.*;
public class App {
/**
* The start point of the program
*
* @param args
*
*/
public static void main(String[] args) {
Scanner keyBoard = new Scanner(System.in);
System.out.print("Enter the score: ");
int score = keyBoard.nextInt();
// 85-100=A+,80-84+A,75-79=B+,70-74=B,65-69=C+,60-64=C,55-59=D+,50-54=D,Below
if (score >= 85 && score <= 100) {
System.out.println("Grade: A+");
} else if (score >= 80 && score <= 84) {
System.out.println("Grade: A");
} else if (score >= 75 && score <= 79) {
System.out.println("Grade: B+");
} else if (score >= 70 && score <= 74) {
System.out.println("Grade: B");
} else if (score >= 65 && score <= 69) {
System.out.println("Grade: C+");
} else if (score >= 60 && score <= 64) {
System.out.println("Grade: C");
} else if (score >= 55 && score <= 59) {
System.out.println("Grade: D+");
} else if (score >= 50 && score <= 54) {
System.out.println("Grade: D");
} else {
System.out.println("Grade: F");
}
keyBoard.close();
}
}
Comments
Leave a comment