[java]代码库
import java.util.Scanner;
/*
* 题目:根据指定月份,打印该月份所属的季节
*
* 春季:3 4 5
* 夏季:6 7 8
* 秋季:9 10 11
* 冬季:12 1 2
*/
public class Test30 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("请输入月份(1-12):");
int month = input.nextInt();
switch (month) {
case 3:
case 4:
case 5:
System.out.println("春季");
break;
case 6:
case 7:
case 8:
System.out.println("夏季");
break;
case 9:
case 10:
case 11:
System.out.println("秋季");
break;
case 12:
case 1:
case 2:
System.out.println("冬季");
break;
default:
System.out.println("输入错误");
break;
}
}
}