-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExercise04_18.java
45 lines (40 loc) · 1.33 KB
/
Exercise04_18.java
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
39
40
41
42
43
44
45
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author jorda
*/
public class Exercise04_18 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter two characters: ");
String major = input.nextLine();
char firstletter = major.charAt(0);
char secondletter = major.charAt(1);
switch(firstletter){
case 'M': System.out.print("Mathematics");
break;
case 'C': System.out.print("Computer Science");
break;
case 'I': System.out.print("Information Technology");
break;
default: System.out.print("Invalid input: Wrong Major Code");
}
System.out.print(" ");
switch(secondletter){
case '1': System.out.println("Freshman");
break;
case '2': System.out.println("Sophomore");
break;
case '3': System.out.println("Junior");
break;
case '4': System.out.println("Senior");
break;
default: System.out.println("Invalid input: wrong status code");
}
}
}