switch...季节


/**
 *  需求:基本练习,输入1---12;查询季节;
 *  思路:switch
 *  {
 *  case :
 *  break;
 *  }  语句;
 *   
 *  步骤:略
 */
import java.util.Scanner;
public class Demo_1{
    public static void main(String[] arge) {
        Scanner input = new Scanner(System.in);
        System.out.println("please enter a number ");
        int Month = input.nextInt();
        switch (Month)
        {
        case 1:
        case 2:
        case 12:
        System.out.println("The month is Winter");
        break;
        case 3:
        case 4:
        case 5:
        System.out.println("The month is Spring");
        break;
        case 6:
        case 7:
        case 8:
        System.out.println("The month is Summer");
        break;
        case 9:
        case 10:
        case 11:
        System.out.println("The month is Autumn");
        break;
        default:
            System.out.println("The month is mistake");
            break;
        }
    }
}

 

 

 

posted on 2017-09-26 22:58  马文奇  阅读(155)  评论(0编辑  收藏  举报

导航