-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitch.java
More file actions
32 lines (29 loc) · 783 Bytes
/
Switch.java
File metadata and controls
32 lines (29 loc) · 783 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
import java.util.Scanner;
public class Switch
{
public static void main (String []args)
{
String year;
char y;
Scanner input = new Scanner (System.in);
System.out.print("Enter Letter: ");
year = input.nextLine();
y = year.charAt(0);
switch (y)
{
case 'F':
case 'f':System.out.println("Freshman");
break;
case 'P':
case 'p':System.out.println("Sophomore");
break;
case 'J':
case 'j':System.out.println("Junior");
break;
case 'S':
case 's':System.out.println("Senior");
break;
default: System.out.println("Invalid Year");
}
}
}