我们已经设置了一项任务来计算用户输入。我的代码可以编译,但是当我测试它时,我的退款输出始终为 0 :( 用户应在提示时输入他们的距离和自我贡献,但我的退款公式到底有什么问题?有人可以对此有所了解吗为了我?
import java.util.*;
public final class UserCalc {`
public static void main(String[] args) {
Scanner scanner = new Scanner(System. in );`
System.out.print("Please enter the distance ");
int distance = scanner.nextInt();
System.out.print("Please enter the percentage of self contribution ");
int selfcon = scanner.nextInt();
int trainprice = (75 + (2 / 10)) * distance;
int carprice = (26 + (7 / 10)) * distance;
int refund = (Math.min(trainprice, carprice)) * ((100 - selfcon) / 100);
System.out.print("You get a refund of " + refund + " pounds");
int age = scanner.nextInt();
}
}