Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions src/src/Main.java
Original file line number Diff line number Diff line change
@@ -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);

}
}
21 changes: 21 additions & 0 deletions src/src/hyeongwon/Case1.java
Original file line number Diff line number Diff line change
@@ -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("정답입니다!");
}
}