Java-第四章-使用switch爲小明制定學習計劃

import java.util.*;
public class ShiDu {
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input =new Scanner(System.in);
		System.out.println("請輸入星期幾:");
		int choice =input.nextInt();
		switch(choice){
		case 1:
		case 3:
		case 5:
			System.out.println("今天星期"+choice+"學習編程");
			break;
		case 2:
		case 4:
		case 6:
			System.out.println("今天星期"+choice+"學習英語!");
			break;
		case 7:
			System.out.println("今天星期"+choice+"休息");
			break;
		default:
		        System.out.println("請輸入正確的數字!");
		}
	}
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章