-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLetter Grade Console
37 lines (30 loc) · 999 Bytes
/
Letter Grade Console
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
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class PrestonPgm03IfElse {
public static void main (String args[]) {
//Variable
int testScore = 0;
// Create keyboard scanner
Scanner keyboard = new Scanner(System.in);
// Get test score
System.out.println("What is your average test score?");
testScore = keyboard.nextInt();
//Assign letter grade
if ( testScore >= 90 && testScore <= 100 ) {
System.out.println("Your average test score is an 'A'!");
}
else if ( testScore >= 80 && testScore <= 89 ) {
System.out.println("Your average test score is an 'B'!");
}
else if ( testScore >= 70 && testScore <= 79 ) {
System.out.println("Your average test score is an 'C'!");
}
else if ( testScore >= 60 && testScore <= 69 ) {
System.out.println("Your average test score is an 'D'!");
}
else if ( testScore <= 59 ) {
System.out.println("Your average test score is an 'F'!");
}
else
System.out.println("You did not enter a proper grade.");
}
}