日期:2014-05-20 浏览次数:20859 次
import java.util.*;
public class Task1 {
public static void main(String[] args) {
int age,sex;
System.out.print("请选择小朋友的性别为1、男 2、女:");
Scanner Sex = new Scanner(System.in);
sex = Sex.nextInt();
System.out.print("请输入小朋友的年龄为");
Scanner Age = new Scanner(System.in);
age = Age.nextInt();
switch(sex) {
case 1:
if(age <= 4) {
System.out.println("不能搬动桌子");
}else {
System.out.println("能搬动桌子");
}
break;
case 2:
if(age <= 7) {
System.out.println("不能搬动桌子");
}else {
System.out.println("能搬动桌子");
}
break;
}
}
}