标签:import rgs code sof log new div auto mon
1 package Exam01; 2 3 import java.util.Scanner; 4 5 public class Topic05 { 6 7 public static void main(String[] args) { 8 // TODO Auto-generated method stub 9 int month = 0; 10 Scanner input = new Scanner(System.in); 11 System.out.println("请输入月份:"); 12 int mouth=input.nextInt(); 13 switch(month){ 14 case 12: 15 case 1: 16 case 2: 17 System.out.println(mouth+"是冬季"); 18 break; 19 case 3: 20 case 4: 21 case 5: 22 System.out.println(mouth+"是春季"); 23 break; 24 case 6: 25 case 7: 26 case 8: 27 System.out.println(mouth+"是夏季"); 28 break; 29 case 9: 30 case 10: 31 case 11: 32 System.out.println(mouth+"是秋季"); 33 break; 34 default: 35 System.out.println("输入不正确"); 36 } 37 } 38 39 }
java编程基础篇-------> 从键盘输入一位整数,代表月份,编程判断指定月份属于一年中的哪个季度。如果是 12 月、1 月、2 月,就属于冬季。
标签:import rgs code sof log new div auto mon
原文地址:http://www.cnblogs.com/liumce/p/7635309.html