-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram67.java
More file actions
28 lines (25 loc) · 829 Bytes
/
Program67.java
File metadata and controls
28 lines (25 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
class CalculateGrade {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the student's score (0-100): ");
int score = input.nextInt();
if (score < 0 || score > 100) {
System.out.println("Invalid score. Please enter a score between 0 and 100.");
} else {
char grade;
if (score >= 90) {
grade = 'A';
} else if (score >= 80) {
grade = 'B';
} else if (score >= 70) {
grade = 'C';
} else if (score >= 60) {
grade = 'D';
} else {
grade = 'F';
}
System.out.println("The student's grade is: " + grade);
}
}
}