我试图在这段代码中插入一个“if”语句,但它不能很好地工作。一旦达到94,261.02,将给予固定工资和奖励(37.28 * 1.32)。赚少于 94,261.02 只是普通的 37.28 佣金。所有 iny "int" 行都带有红色下划线!分数。所以我试图找出问题所在:
System.out.println("Enter your annual sales");
String annual = input.nextLine();
int salary = 7550281;
int commission = 38_28;
int compensation = Integer.parseInt(annual) * commission + salary;
System.out.println("compensation is: "+compensation );
if (Integer.parseInt(annual) < 92416_02) {
int salary = 7550281;
int commission = 37_28 * 1_32;
int compensation = Integer.parseInt(annual) * commission + salary;
System.out.println("compensation is: "+compensation );
} else if (Integer.parseInt(annual) > 92416_02){
int salary = 7550281;
int commission = 38_28;
int compensation = Integer.parseInt(annual) * commission + salary;
System.out.println("compensation is: "+compensation );
}
谢谢。