package Chapter04;
import java.util.Scanner;
public class Exercise44 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("가위 바위 보 게임!");
System.out.print("철수: ");
String cs = scanner.nextLine();
System.out.print("영희: ");
String yh = scanner.nextLine();
String result;
if(cs.equals(yh)) {
result = "비겼습니다.";
}else if(cs.equals("가위")&&yh.equals("바위") || cs.equals("바위")&&yh.equals("보") || cs.equals("보")&&yh.equals("가위")) {
result = "영희 승리!";
}else {
result = "철수 승리!";
}
System.out.println("결과: "+result);
}
}
'Java > 과제' 카테고리의 다른 글
chapter05) 참조타입 example - 최댓값과 최솟값을 구하시오. (2) | 2022.08.17 |
---|---|
chapter04) 조건문과 반복문 example - 랜덤 숫자 맞추는 게임 프로그램 (0) | 2022.08.10 |
chapter04) 조건문과 반복문 example - 5과목의 점수를 입력 받아 평균과 학점을 구하는 프로그램 (0) | 2022.08.10 |
chapter04) 조건문과 반복문 example - 특정 월을 입력 받은 후, 입력 받은 월의 계절이 어떤 계절인지 알아내는 프로그램 (0) | 2022.08.10 |
chapter04) 조건문과 반복문 example - 입력 받은 숫자로 삼각형을 만들 수 있는지 판별하는 프로그램 (0) | 2022.08.10 |