문제
사용자의 생년월일을 입력받아 그 결과를 출력하는 문제입니다 이를 해결하는 프로그램의 다음 실행상태에 대해 빈칸을 채우세요
프로그램의 실행순서 및 실행상태
1 public static void main( String[] args ) {
2 System.out.print( "당신이 태어난 년도를 입력하세요: " );
당신이 태어난 년도를 입력하세요:
3 int year = scan.nextInt();
1397
4 System.out.print( "당신이 태어난 달을 입력하세요: " );
당신이 태어난 달을 입력하세요:
5 int month = scan.nextInt();
5
6 System.out.print( "당신이 태어난 날을 입력하세요: " );
당신이 태어난 날을 입력하세요:
7 int day = scan.nextInt();
15
8 System.out.println( "당신은 " + year + "년 " + month + "월 " + day + "일에 태어났군요. \n당신은 ♪~ 사랑받기 위해 ♪~ 태어난 사람 ♬~~ " );
당신은 1397년 5월 15일에 태어났군요.
당신은 ♪~ 사랑받기 위해 ♪~ 태어난 사람 ♬~~
9 }
프로그램 코드
import java.util.Scanner;
public class Birthday
{
1 public static void main( String[] args ) {
Scanner scan = new Scanner( System.in );
2 System.out.print( "당신이 태어난 년도를 입력하세요: " );
3 int year = scan.nextInt();
4 System.out.print( "당신이 태어난 달을 입력하세요: " );
5 int month = scan.nextInt();
6 System.out.print( "당신이 태어난 날을 입력하세요: " );
7 int day = scan.nextInt();
8 System.out.println( "당신은 " + year + "년 " + month + "월 " + day + "일에 태어났군요. \n당신은 ♪~ 사랑받기 위해 ♪~ 태어난 사람 ♬~~ " );
scan.close();
9 }
}