您好,例如我的代码如下:
double mealCost = scan.nextDouble(); // original meal price
int tipPercent = scan.nextInt(); // tip percentage
int taxPercent = scan.nextInt(); // tax percentage
double totalPercent=tipPercent/100*mealCost;
当我使用这些数据运行此代码时:
mealCost=20
tipPercent=12.00
taxPercent=8
结果我得到0,但它必须是2.4,我不明白为什么。