import java.util.Scanner;
class Zuo1{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("输入工龄");
int x = sc.nextInt();
System.out.println("输入基本工资");
int y = sc.nextInt();
if (x >=10 & x <15)
{
int z = 5000;
int sum = z + y;
System.out.println("您目前工作了" + x + "年" +",基本工资为" + y + "元" + ",应涨工资" + z + "元" + ",涨后工资" + sum +"元");
}else if (x >=5 & x <10)
{
int z = 2500;
int sum = z + y;
System.out.println("您目前工作了" + x + "年" +",基本工资为" + y + "元" + ",应涨工资" + z + "元" + ",涨后工资" + sum +"元");
}else if (x >=3 & x < 5)
{
int z = 1000;
int sum = z + y;
System.out.println("您目前工作了" + x + "年" +",基本工资为" + y + "元" + ",应涨工资" + z + "元" + ",涨后工资" + sum +"元");
}else if (x >=1 & x <3)
{
int z = 500;
int sum = z + y;
System.out.println("您目前工作了" + x + "年" +",基本工资为" + y + "元" + ",应涨工资" + z + "元" + ",涨后工资" + sum +"元");
}else if (x == 0)
{
int z = 200;
int sum = z + y;
System.out.println("您目前工作了" + x + "年" +",基本工资为" + y + "元" + ",应涨工资" + z + "元" + ",涨后工资" + sum +"元");
}else {
System.out.println("无法识别你的工龄");
}
}
}作者: itismyhao 时间: 2016-7-25 01:52
先用逻辑判断再打印会好点