-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChar_case.java
More file actions
36 lines (30 loc) · 1.14 KB
/
Char_case.java
File metadata and controls
36 lines (30 loc) · 1.14 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.*;
public class Char_case {
public static void main(String[] args){
System.out.print("주민등록번호를 입력해주세요. (123456-1234567) >> ");
Scanner sc = new Scanner(System.in);
String regNo = sc.nextLine();
char gender = regNo.charAt(7);
String birth = regNo.substring(0,2);
System.out.printf("%c %n",gender);
switch (gender){
case '1': case '3':
switch (gender){
case '1':
System.out.printf("19%s년생 남성입니다.",birth);
break;
case '3':
System.out.printf("20%s년생 남성입니다.",birth);
break;
}
case '2': case '4':
switch (gender) {
case '2':
System.out.printf("19%s년생 여성입니다.");
break;
case '4':
System.out.printf("20%s년생 여성입니다.");
}
}
}
}