-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchGradeInput.java
More file actions
36 lines (35 loc) · 1.01 KB
/
SwitchGradeInput.java
File metadata and controls
36 lines (35 loc) · 1.01 KB
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 SwitchGradeInput
{
public static void main(String [] args)
{
int gradeInput = -1;
Scanner scan = new Scanner(System.in);
while( gradeInput < 0 || gradeInput > 100 )
{
System.out.print("Enter a grade between 0 and 100: ");
gradeInput = scan.nextInt();
}
System.out.println( gradeInput / 10 );
switch( gradeInput / 10 )
{
case 10:
System.out.println("Perfect.");
break;
case 9:
System.out.println("A, Nice!");
break;
case 8:
System.out.println("B, pretty good");
break;
case 7:
System.out.println("C, average.");
break;
case 6:
System.out.println("D, almost a failure.");
break;
default:
System.out.println("Complete failure.");
}
}
}