编写程序,从键盘接收整数参数。如果该数为1-7,打印对应的星期值,否则打印“非法参数”。

import java.util.Scanner;

class Exer1 {
	public static void main(String[] args) {
		Scanner scan = new Scanner (System.in);

		System.out.println("请输入星期值:");
		int week = scan.nextInt();

		switch (week){
		case 1:
			System.out.println("星期一:Monday");
			break;
		case 2:
			System.out.println("星期二:Tuesday");
			break;
		case 3:
			System.out.println("星期三:Wednesday");
			break;
		case 4:
			System.out.println("星期四:Thursday");
			break;
		case 5:
			System.out.println("星期五:Friday");
			break;
		case 6:
			System.out.println("星期六:Saturday");
			break;
		case 7:
			System.out.println("星期日:Sunday");
			break;
		default:
			System.out.println("非法星期值");
			break;
		}
	}
}

 

上一篇:PS水彩教程:打造水彩素描的真人美女头像图片


下一篇:Photoshop将人像照片调出复古的淡黄色效果