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
| package MyLibrarySystem;
import java.util.Scanner;
public class LibraryMain {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
MemberInfo user = new MemberInfo();
BookInfo book = new BookInfo();
int num;
boolean open;
open = book.open();
if(open==true) {
while(true) {
if(user.loginMember() == null) {
do {
System.out.print("1. 로그인 2. 회원가입 3. 종료 : ");
num = sc.nextInt();
sc.nextLine();
} while(num < 1 || num > 3);
if(num == 3) {
System.out.println("도서관 시스템을 종료합니다.");
break;
}
switch(num) {
case 1 :
user.logIn();
break;
case 2 :
user.join();
break;
}
} else if(user.loginMember().getId() == "cm") {
do {
System.out.print("1. 도서관리 2. 회원관리 3. 로그아웃 4. 종료 : ");
num = sc.nextInt();
sc.nextLine();
} while(num < 1 || num > 4);
if(num == 4) {
System.out.println("도서관 시스템을 종료합니다.");
break;
}
switch(num) {
case 1 :
do {
System.out.print("1. 도서등록 2. 도서수정 3. 도서삭제 4. 도서검색 5. 도서리스트 6. 복귀");
num = sc.nextInt();
sc.nextLine();
} while(num < 1 || num > 6);
switch(num) {
case 1 :
book.bookAdd();
break;
case 2 :
book.bookInfoChange();
break;
case 3 :
book.bookDelete();
break;
case 4 :
book.bookSearch();
break;
case 5 :
book.printBookList();
break;
case 6 :
break;
}
break;
case 2 :
do {
System.out.print("1. 회원 리스트 2. 이름검색 3. 회원삭제 4.복귀");
num = sc.nextInt();
sc.nextLine();
} while(num < 1 || num > 4);
switch(num) {
case 1 :
user.printUserList();
break;
case 2 :
user.userSearch();
break;
case 3 :
user.userDelete();
break;
case 4 :
break;
}
break;
case 3 :
user.logOut();
break;
}
} else {
do {
System.out.print("1. 도서대여 2. 도서반납 3. 도서검색 4. 정보수정 5. 로그아웃 6. 회원탈퇴 7. 종료");
num = sc.nextInt();
sc.nextLine();
} while(num < 1 || num > 7);
if(num==7) {
System.out.println("도서관 시스템을 종료합니다.");
break;
}
switch(num) {
case 1 :
book.borrow();
break;
case 2 :
book.returnBook();
break;
case 3 :
book.bookSearch();
break;
case 4 :
user.userUpdate();
break;
case 5 :
user.logOut();
break;
case 6 :
user.userDelete();
break;
}
}
}
} else {
book.close();
}
}
}
|