diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..5ff6309
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+
+### IntelliJ IDEA ###
+.idea/modules.xml
+.idea/jarRepositories.xml
+.idea/compiler.xml
+.idea/libraries/
+*.iws
+*.iml
+*.ipr
+
+### Eclipse ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+!**/src/main/**/build/
+!**/src/test/**/build/
+
+### VS Code ###
+.vscode/
+
+### Mac OS ###
+.DS_Store
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1c85357
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..30b0742
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,38 @@
+
+ 4.0.0
+
+ com.example
+ codereview
+ 1.0-SNAPSHOT
+
+
+
+
+ 23
+ 23
+
+
+
+
+ com.googlecode.json-simple
+ json-simple
+ 1.1.1
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+ 23
+ 23
+
+
+
+
+
diff --git a/src/main/java/org/example/App.java b/src/main/java/org/example/App.java
new file mode 100644
index 0000000..a8adc13
--- /dev/null
+++ b/src/main/java/org/example/App.java
@@ -0,0 +1,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);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/Main.java b/src/main/java/org/example/Main.java
new file mode 100644
index 0000000..023bd19
--- /dev/null
+++ b/src/main/java/org/example/Main.java
@@ -0,0 +1,11 @@
+package org.example;
+
+//TIP To Run code, press or
+// click the icon in the gutter.
+public class Main {
+ public static void main(String[] args) {
+
+ App app = new App();
+ app.run();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/Test.java b/src/main/java/org/example/Test.java
new file mode 100644
index 0000000..4eec911
--- /dev/null
+++ b/src/main/java/org/example/Test.java
@@ -0,0 +1,4 @@
+package org.example;
+
+public class Test {
+}
diff --git a/src/main/java/org/example/wiseSaying/SystemController.java b/src/main/java/org/example/wiseSaying/SystemController.java
new file mode 100644
index 0000000..6f08758
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/SystemController.java
@@ -0,0 +1,9 @@
+package org.example.wiseSaying;
+
+
+public class SystemController {
+
+ public void exit() {
+ System.out.println("명언 앱을 종료합니다.");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSaying.java b/src/main/java/org/example/wiseSaying/WiseSaying.java
new file mode 100644
index 0000000..aa0f348
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSaying.java
@@ -0,0 +1,38 @@
+package org.example.wiseSaying;
+
+public class WiseSaying {
+ private int id;
+ private String content;
+ private String author;
+
+ public WiseSaying(int id, String content, String author) {
+ this.id = id;
+ this.content = content;
+ this.author = author;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public String getAuthor() {
+ return author;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSayingController.java b/src/main/java/org/example/wiseSaying/WiseSayingController.java
new file mode 100644
index 0000000..9a73f99
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSayingController.java
@@ -0,0 +1,75 @@
+package org.example.wiseSaying;
+import java.util.ArrayList;
+import java.util.Scanner;
+
+public class WiseSayingController {
+
+ private final WiseSayingService wiseSayingService;
+ private final Scanner scanner;
+
+ public WiseSayingController(Scanner scanner) {
+ this.scanner = scanner;
+ this.wiseSayingService = new WiseSayingService(new WiseSayingMemRepository());
+ }
+
+ public void updateWiseSaying(int targetId) {
+
+ WiseSaying wiseSaying = wiseSayingService.getItem(targetId);
+
+ if (wiseSaying == null) {
+ System.out.println("%d번 명언은 존재하지 않습니다.".formatted(targetId));
+ return;
+ }
+
+ System.out.println("명언(기존) : %s".formatted(wiseSaying.getContent()));
+ System.out.print("명언 : ");
+ String newContent = scanner.nextLine();
+ System.out.println("명언(작가) : %s".formatted(wiseSaying.getAuthor()));
+ System.out.print("작가 : ");
+ String newAuthor = scanner.nextLine();
+
+ wiseSayingService.modify(wiseSaying, newContent, newAuthor);
+ System.out.println("%d번 명언이 수정되었습니다.".formatted(targetId));
+
+ }
+
+ public void deleteWiseSaying(int targetId) {
+
+ WiseSaying wiseSaying = wiseSayingService.getItem(targetId);
+
+ if (wiseSaying == null) {
+ System.out.println("%d번 명언은 존재하지 않습니다.".formatted(targetId));
+ return;
+ }
+
+ wiseSayingService.remove(wiseSaying);
+ System.out.println("%d번 명언이 삭제되었습니다.".formatted(targetId));
+ }
+
+ public void printWiseSayingList() {
+ System.out.println("번호 / 작가 / 명언");
+ System.out.println("----------------------");
+
+ ArrayList wiseSayings = wiseSayingService.getItems();
+
+ for (WiseSaying wiseSaying : wiseSayings.reversed()) {
+ System.out.println("%d / %s / %s".formatted(wiseSaying.getId(), wiseSaying.getAuthor(), wiseSaying.getContent()));
+ }
+ }
+
+ public void writeWiseSaying() {
+ System.out.print("명언 : ");
+ String content = scanner.nextLine();
+
+ System.out.print("작가 : ");
+ String author = scanner.nextLine();
+
+ WiseSaying wiseSaying = wiseSayingService.write(content, author);
+ System.out.println("%d번 명언이 등록되었습니다.".formatted(wiseSaying.getId()));
+ }
+
+ public void makeTestData() {
+ wiseSayingService.write("꿈을 지녀라. 그러면 어려운 현실을 이길 수 있다.", "월트 디즈니");
+ wiseSayingService.write("현재를 사랑하라", "작자 미상");
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSayingFileRepository.java b/src/main/java/org/example/wiseSaying/WiseSayingFileRepository.java
new file mode 100644
index 0000000..1619031
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSayingFileRepository.java
@@ -0,0 +1,32 @@
+package org.example.wiseSaying;
+
+import java.util.ArrayList;
+
+public class WiseSayingFileRepository implements WiseSayingRepository{
+
+ // 오버라이딩
+ public WiseSaying findById(int id) {
+ return null;
+ }
+
+ @Override
+ public WiseSaying add(String content, String author) {
+ return null;
+ }
+
+ @Override
+ public void update(WiseSaying wiseSaying) {
+
+ }
+
+ @Override
+ public ArrayList findAll() {
+ return null;
+ }
+
+ @Override
+ public void remove(WiseSaying wiseSaying) {
+
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSayingMemRepository.java b/src/main/java/org/example/wiseSaying/WiseSayingMemRepository.java
new file mode 100644
index 0000000..fca7fa8
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSayingMemRepository.java
@@ -0,0 +1,37 @@
+package org.example.wiseSaying;
+
+import java.util.ArrayList;
+
+public class WiseSayingMemRepository implements WiseSayingRepository {
+ private final ArrayList wiseSayingList = new ArrayList<>();
+ private int lastId = 0;
+
+ public WiseSaying findById(int targetId) {
+ for (WiseSaying wiseSaying : wiseSayingList) {
+ if (wiseSaying.getId() == targetId) {
+ return wiseSaying;
+ }
+ }
+
+ return null;
+ }
+
+ public WiseSaying add(String content, String author) {
+ int id = ++lastId;
+ WiseSaying wiseSaying = new WiseSaying(id, content, author);
+ wiseSayingList.add(wiseSaying);
+ return wiseSaying;
+ }
+
+ public ArrayList findAll() {
+ return wiseSayingList;
+ }
+
+ public void remove(WiseSaying wiseSaying) {
+ wiseSayingList.remove(wiseSaying);
+ }
+
+ public void update(WiseSaying wiseSaying) {
+ // 현재는 메모리에 저장하기 때문에 별도의 업데이트 코드 없음.
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSayingRepository.java b/src/main/java/org/example/wiseSaying/WiseSayingRepository.java
new file mode 100644
index 0000000..e218f13
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSayingRepository.java
@@ -0,0 +1,11 @@
+package org.example.wiseSaying;
+
+import java.util.ArrayList;
+
+public interface WiseSayingRepository {
+ WiseSaying findById(int id);
+ WiseSaying add(String content, String author);
+ void update(WiseSaying wiseSaying);
+ ArrayList findAll();
+ void remove(WiseSaying wiseSaying);
+}
\ No newline at end of file
diff --git a/src/main/java/org/example/wiseSaying/WiseSayingService.java b/src/main/java/org/example/wiseSaying/WiseSayingService.java
new file mode 100644
index 0000000..c5e94d5
--- /dev/null
+++ b/src/main/java/org/example/wiseSaying/WiseSayingService.java
@@ -0,0 +1,35 @@
+package org.example.wiseSaying;
+import java.util.ArrayList;
+
+public class WiseSayingService {
+
+ private final WiseSayingRepository wiseSayingRepository;
+
+ public WiseSayingService(WiseSayingRepository wiseSayingRepository) {
+ this.wiseSayingRepository = wiseSayingRepository;
+ }
+
+ public WiseSaying getItem(int targetId) {
+ return wiseSayingRepository.findById(targetId);
+ }
+
+ public void modify(WiseSaying wiseSaying, String newContent, String newAuthor) {
+
+ wiseSaying.setContent(newContent);
+ wiseSaying.setAuthor(newAuthor);
+
+ wiseSayingRepository.update(wiseSaying);
+ }
+
+ public WiseSaying write(String content, String author) {
+ return wiseSayingRepository.add(content, author);
+ }
+
+ public ArrayList getItems() {
+ return wiseSayingRepository.findAll();
+ }
+
+ public void remove(WiseSaying wiseSaying) {
+ wiseSayingRepository.remove(wiseSaying);
+ }
+}
\ No newline at end of file