diff --git a/.idea/misc.xml b/.idea/misc.xml index 639900d..6ff3c25 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/src/Main.java b/src/src/Main.java index 9983b50..067018b 100644 --- a/src/src/Main.java +++ b/src/src/Main.java @@ -1,10 +1,8 @@ -import base.Case1; +import hyeongwon.Case1; public class Main { public static void main(String[] args) { Case1 case1 = new Case1(); - case1.gameStart(3); - } } \ No newline at end of file diff --git a/src/src/hyeongwon/Case1.java b/src/src/hyeongwon/Case1.java new file mode 100644 index 0000000..360888d --- /dev/null +++ b/src/src/hyeongwon/Case1.java @@ -0,0 +1,21 @@ +package hyeongwon; + +import java.util.Scanner; + +public class Case1 { + public void gameStart(int randomNum) { + Scanner scanner = new Scanner(System.in); + int userInput = 0; + do { + System.out.println("숫자를 예측하세요."); + userInput = scanner.nextInt(); + if (randomNum < userInput) { + System.out.println("DOWN"); + } else if (randomNum > userInput) { + System.out.println("UP"); + } + } while (userInput != randomNum) ; + System.out.println("GOOD"); + System.out.println("정답입니다!"); + } + } \ No newline at end of file