-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrade.java
More file actions
38 lines (28 loc) · 740 Bytes
/
Grade.java
File metadata and controls
38 lines (28 loc) · 740 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
29
30
31
32
33
34
35
36
37
38
import java.util.Scanner;
public class Grade{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
System.out.print("Enter your grade(A-F): ");
String letter = input.nextLine();
switch(letter){
case "a":
case "b":
case "c":
case "d":System.out.print("pass");break;
case "e":System.out.print("fair");break;
case "f":System.out.print("failed");break;
default:System.out.print("invalid");break;
}
}
}
/*
Student's grade
prompt the user to enter their grade (A-f)
create a variable that reads the users input
check if the user enter (A- D)
print "pass"
check if the user enter (e)
print"fair"
check if the user enter (f)
print "failed"
else "invalid"