Javaベースの日は今日です

1つの インポートjava.util.Scanner。
2  
3  パブリック クラスcourse01 {
 4      パブリック 静的な 無効メイン(文字列[] args)を{
 5          のSystem.out.println( " '今日は何の日'へようこそ" );
6  
7          =スキャナ新しいスキャナ(System.in)。
8  
9          のSystem.out.println( "年を入力します(たとえば、2012)" );
10          int型年= in.nextInt();
11  
12          のSystem.out.println( "月を入力:1から12:" );
13          int型ヶ月=in.nextInt();
14  
15          のSystem.out.println( "月の日を入力します:1 - 31:" );
16          int型日= in.nextInt()。
17  
18  //         するSystem.out.println(年+月+日)。
19  
20          int型温度= 月。
21          であれば(一時== 1 ){
 22              月= 13 23              年- = 1 ;
24          }
 25          そう であれば(TEMP == 2 ){
 26              月= 14 27              年- = 1;
28          }
 29  
30          int型 K =年間100% 31          int型 J =年/ 100 ;
32  
33          のint H =(日+ 26 *(月+ 1)/ 10 + K + K / 4 + J / 4 + 5 * J)%7 34  
35  //         のSystem.out.println(H)。
36  
37          スイッチ(H){
 38              ケース 0:のSystem.out.println( "曜日が土曜日です")。破ります;
39              ケース 1:するSystem.out.println(「曜日は日曜日です」); 破ります;
40              ケース2:するSystem.out.println(「曜日が月曜日です」); 破ります;
41              ケース 3:System.out.printlnは(「曜日が火曜日です」)。破ります;
42              ケース 4:System.out.printlnは(「曜日は水曜日です」); 破ります;
43              ケース 5:System.out.printlnは(「曜日が木曜日です」); 破ります;
44              ケース 6:System.out.printlnは(「曜日が金曜日です」); 破ります;
45          }
 46      }
 47 }

おすすめ

転載: www.cnblogs.com/yingni/p/11440646.html