공부하시는대에 도움이 됐으면 좋겠습니다.
답안코드 확인해주세요!
더보기
import java.util.Scanner;
public class Main {
public static void call(int month, int day) {
if ((month == 1) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 2) && (day > 29 || day < 0))
System.out.println("BAD!");
else if ((month == 3) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 4) && (day > 30 || day < 0))
System.out.println("BAD!");
else if ((month == 5) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 6) && (day > 30 || day < 0))
System.out.println("BAD!");
else if ((month == 7) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 8) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 9) && (day > 30 || day < 0))
System.out.println("BAD!");
else if ((month == 10) && (day > 31 || day < 0))
System.out.println("BAD!");
else if ((month == 11) && (day > 30 || day < 0))
System.out.println("BAD!");
else if ((month == 12) && (day > 31 || day < 0))
System.out.println("BAD!");
else if (month>12 || day<=0)
System.out.println("BAD!");
else
System.out.println("OK!");
}
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int month = in.nextInt();
int day = in.nextInt();
call(month,day);
}
}
더 많은 자바코드가 보고 싶다면?
댓글