-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathApp.java
More file actions
46 lines (38 loc) · 1.5 KB
/
App.java
File metadata and controls
46 lines (38 loc) · 1.5 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
package org.example;
import org.example.wiseSaying.WiseSayingController;
import org.example.wiseSaying.SystemController;
import java.util.Scanner;
public class App {
private final WiseSayingController wiseSayingController;
private final SystemController systemController;
private final Scanner scanner;
public App() {
scanner = new Scanner(System.in);
wiseSayingController = new WiseSayingController(scanner);
systemController = new SystemController();
}
public void run() {
wiseSayingController.makeTestData();
System.out.println("== 명언 앱 ==");
while (true) {
System.out.print("명령) ");
String command = scanner.nextLine();
if (command.equals("종료")) {
systemController.exit();
break;
} else if (command.equals("등록")) {
wiseSayingController.writeWiseSaying();
} else if (command.equals("목록")) {
wiseSayingController.printWiseSayingList();
} else if (command.startsWith("삭제?id=")) {
String strId = command.substring(6);
int id = Integer.parseInt(strId);
wiseSayingController.deleteWiseSaying(id);
} else if (command.startsWith("수정?id=")) {
String strId = command.substring(6);
int id = Integer.parseInt(strId);
wiseSayingController.updateWiseSaying(id);
}
}
}
}