문제
입력받은 달의 영어이름을 출력하는 문제입니다 이를 해결하는 프로그램의 다음 실행상태에 대해 빈칸을 채우세요
프로그램의 실행순서 및 실행상태
1 public static void main( String[] args ) {
2 int month = scan.nextInt();
1월 ~ 12월 사이의 월을 입력하세요: 3
3 switch ( month ) {
4 case 1:
7 case 2:
10 case 3:
11 System.out.print( "3월은 March입니다" );
3월은 March입니다
12 break;
39 }
프로그램 코드
import java.util.Scanner;
public class Month
{
1 public static void main( String[] args ) {
Scanner scan = new Scanner( System.in );
System.out.print( "1월 ~ 12월 사이의 월을 입력하세요: " );
2 int month = scan.nextInt();
3 switch ( month ) {
4 case 1:
5 System.out.print( "1월은 January입니다" );
6 break;
7 case 2:
8 System.out.print( "2월은 February입니다" );
9 break;
10 case 3:
11 System.out.print( "3월은 March입니다" );
12 break;
13 case 4:
14 System.out.print( "4월은 April입니다" );
15 break;
16 case 5:
17 System.out.print( "5월은 May입니다" );
18 break;
19 case 6:
20 System.out.print( "6월은 June입니다" );
21 break;
22 case 7:
23 System.out.print( "7월은 July입니다" );
24 break;
25 case 8:
26 System.out.print( "8월은 August입니다" );
27 break;
28 case 9:
29 System.out.print( "9월은 September입니다" );
30 break;
31 case 10:
32 System.out.print( "10월은 October입니다" );
33 break;
34 case 11:
35 System.out.print( "11월은 November입니다" );
36 break;
37 default:
38 System.out.print( "12월은 December입니다" );
}
scan.close();
39 }
}