3층 1구역 - 개발의 장(355)
-
JAVA - while(true) switch-break문을 이용한 다이스 롤! 게임 (2022-07-18)
package loop_while; import java.util.Random; import java.util.Scanner; public class Quiz08 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int cost = 10000; //초기 배팅금액 선언 int win = 0; intdrow = 0; int lose = 0; while(true) { System.out.println("--- Dice Roll Game ---"); System.out.println("1. Game Start"); System.out.println("2. Game Score"); System.out.println("3...
2022.07.19 -
JAVA - while(true) switch-break문을 이용한 Up&Down 게임 (2022-07-18)
package loop_while; import java.util.Random; import java.util.Scanner; public class Quiz07_Teach { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int bestScore = 0; while (true) { System.out.println("=== Up & Down Game =="); System.out.println("1. Game Start"); System.out.println("2. Game Score"); System.out.println("3. Game Exit"); System.out.print(">> "); String ..
2022.07.19 -
JAVA - while(true)와 switch-break문을 이용한 가위 바위 보! 게임 (2022-07-18)
package loop_while; import java.util.Scanner; public class Quiz06 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { //true일 때, 다음 메뉴를 반복 System.out.println("=== 가위 바위 보 게임 ==="); System.out.println("1.가위 / 2.바위 / 3.보 / 0.종료"); System.out.print(">>>"); int side = sc.nextInt(); int game = 0; for (int i = 1; i < 3; i++) //랜덤 숫자를 생성할 때 몇 개를 생성하는가? game = (..
2022.07.19 -
JAVA - 동전 앞, 뒷면 맞추는 퀴즈
package repeat_0717; import java.util.Scanner; public class while_Quiz05 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while(true) { //true일 때, 다음 메뉴를 반복 System.out.println("=== 동전 앞/뒤 맞추기 ==="); System.out.println("1. 앞 / 2. 뒤 /3. 종료"); System.out.print(">>>"); int side = sc.nextInt(); int coin = 0; //변수 선언 후 초기화 for (int i = 1; i < 2; i++) //랜덤 숫자를 생성할 때 몇 개를 ..
2022.07.17 -
JAVA - 회원가입하고 로그인하는 퀴즈
package loop_while; import java.util.Scanner; public class Quiz04 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String saveId, savePass, checkId, checkPass; saveId = savePass = checkId = checkPass = ""; while (true) { System.out.println("1. 회원가입"); System.out.println("2. 로그인"); System.out.println("3. 나가기"); System.out.print(">>> "); String select = sc.next(); sw..
2022.07.17 -
JAVA - 3,6,9게임의 3,6,9,의 박수의 개수 구하는 퀴즈
package loop_while; import java.util.Scanner; public class Quiz03 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("369게임의 3,6,9의 박수의 개수 구하기"); /*System.out.print("수 입력 : "); int num = sc.nextInt(); int count = 0; for(int i = 1; i
2022.07.17