//输入一个值x后,判断x的范围后进行运算
public static void test1() {
int y, t = 0;
System.out.println("请输入x的值");
Scanner sc = new Scanner(System.in);
short x = sc.nextShort();
if (x > 0) {
t = 1;
} else if (x < 0) {
t = 2;
} else if (x == 0) {
t = 0;
}
switch (t) {
case 0:
y = x + 20;
System.out.println("y的值为" + y);
break;
case 1:
y = x + 10 * 5;
System.out.println("y的值为" + y);
break;
case 2:
y = x + 50 / 3;
System.out.println("y的值为" + y);
break;
}