-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.java
More file actions
155 lines (142 loc) · 5.16 KB
/
Menu.java
File metadata and controls
155 lines (142 loc) · 5.16 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import java.io.Serializable;
import java.util.Scanner;
public class Menu implements Serializable{
static transient Scanner sc = new Scanner(System.in);
Main main = new Main();
int selectMainDisplay() {
//main.loadUserList();
//System.out.println("메뉴에서 첫번째 확인 : " +main.userMap.toString());
System.out.println("────────────────────────────────────");
System.out.println("1:회원가입 2:로그인 0:프로그램 종료");
System.out.println("────────────────────────────────────");
int menuUserInput = 0;
do {
try {
menuUserInput = Integer.parseInt(sc.nextLine());
if (menuUserInput >= 0 && menuUserInput <=2) {
break;
} else {
throw new Exception("showMainDisplay() Method 예외 발생");
}
} catch (Exception e) {
System.out.println("선택 문제");
System.out.println("0 - 2번까지 선택 가능합니다");
}
} while (true);
return menuUserInput;
}
void showMainDisplay() {
while (true) {
switch (selectMainDisplay()) {
case 1: this.main.signIn(); // 회원가입 함수 호출
break;
case 2: this.main.logIn(); // 로그인 함수 호출
showPersonManagerDisplay();
break;
case 0: System.out.println("프로그램 종료합니다");
this.main.logOut();
if(this.main.pmMap.isEmpty()) {
System.out.println("저장된 정보 없음");
}else {
// this.main.saveFile2();
}
System.exit(0);
default :
System.out.println("잘못된 값을 입력하셨습니다. 다시입력하세요.");
}
}
}
int selectPersonManagerDisplay() {
System.out.println("──────────────────────────────────────────────────────────────────────────────");
System.out.println("1:지인목록 출력 2:지인정보 입력 3:지인정보 변경 4.지인정보삭제 5.이벤트 관리 6.비밀번호변경 0.로그아웃");
System.out.println("──────────────────────────────────────────────────────────────────────────────");
int menuUserInput = 0;
do {
try {
menuUserInput = Integer.parseInt(sc.nextLine());
if (menuUserInput >= 0 && menuUserInput <=6) {
break;
} else {
throw new Exception("selectPersonManagerDisplay() Method 예외 발생");
}
} catch (Exception e) {
System.out.println("선택 문제");
System.out.println("0~5번까지 선택");
}
} while (true);
return menuUserInput;
}
void showPersonManagerDisplay() {
boolean shouldExit = false;
while (true) {
int userInput = selectPersonManagerDisplay();
switch (userInput) {
case 1: this.main.pmMap.get(this.main.getLoginId()).showAllInfo(); // 전체지인목록출력
break;
case 2: this.main.pmMap.get(this.main.getLoginId()).inputPersonInfo(); // 지인정보입력
break;
case 3: this.main.pmMap.get(this.main.getLoginId()).modifyInfo(); // 지인정보수정
break;
case 4: this.main.pmMap.get(this.main.getLoginId()).removeInfo(); // 지인정보삭제
break;
case 5: this.showEventManagingDisplay(); // 이벤트 관리
break;
case 6: this.main.setPassword(); // 비밀번호 변경
break;
case 0: System.out.println("사용해주셔서 감사합니다."); // 로그아웃 + 자동저장
shouldExit = true;
break;
default :
System.out.println("잘못된 값을 입력하셨습니다. 다시입력하세요.");
}
if (shouldExit) {
break;
}
}
}
int selectEventManagingDisplay() {
System.out.println("───────────────────────────────────────────────────────────────");
System.out.println("1:전체 이벤트목록 출력 2:이벤트 입력 3:이벤트정보 변경 4.이벤트 삭제 5.적정경조사비 출력 0.뒤로가기");
System.out.println("───────────────────────────────────────────────────────────────");
int menu = 0;
do {
try {
menu = Integer.parseInt(sc.nextLine());
if (menu >= 0 && menu <=5) {
break;
} else {
throw new Exception("selectPersonManagerDisplay() Method 예외 발생");
}
} catch (Exception e) {
System.out.println("선택 문제");
System.out.println("0 - 4번까지 선택 가능합니다");
}
} while (true);
return menu;
}
void showEventManagingDisplay() {
boolean shouldExit = false;
while (true) {
switch (selectEventManagingDisplay()) {
case 1: this.main.pmMap.get(this.main.getLoginId()).eventlist(); // 1:전체 이벤트목록 출력
break;
case 2: this.main.pmMap.get(this.main.getLoginId()).inputInfo(); // 2:이벤트 입력
break;
case 3: this.main.pmMap.get(this.main.getLoginId()).modifyEventInfo(); // 3:이벤트정보 변경
break;
case 4: this.main.pmMap.get(this.main.getLoginId()).removeEventInfo(); // 4.이벤트 삭제
break;
case 5: this.main.pmMap.get(this.main.getLoginId()).suggestMoney(); // 5.적정 경보사비 출력
break;
case 0: // 0. 뒤로가기
shouldExit = true;
break;
default :
System.out.println("잘못된 값을 입력하셨습니다. 다시입력하세요.");
}
if (shouldExit){
break;
}
}
}
}