//设计一个程序,键盘输入月份,控制条输出季节.3,4,5春季/6,7,8夏季/9,10,11秋季/12,1,2冬季
import java.util.Scanner;
public class Test04{
public static void main(String[] args){
System.out.println("请输入月份");
Scanner sc = new Scanner(System.in);
int mouth=sc.nextInt();
switch(mouth){
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("输入不正确");
}
}
}
|
|