我想从当前读数中减少“以前的仪表读数”。但是仍然为当前读数进行账单计算。看起来很简单,但是我找不到问题所在。
Intent i = getIntent();
final double con = i.getDoubleExtra("Value", 0.0);
final double pre = i.getDoubleExtra("Value1", 0.0);
cur_units.setText("" + con);
pre_units.setText("" + pre);
Test = con - pre;
Units = Test;
if (Units <= 5) {
Amount = Units * 12;
Ser_Charge = 50;
} else if (Units <= 10) {
// For the First Five Units Charge = 60 (5 * 12)
// Next, we are removing those 5 units from total units
Amount = 60 + ((Units - 5) * 16);
Ser_Charge = 65;
} else if (Units <= 15) {
// First Five Units charge = 60, and 6 - 10 is 80 (5 * 16)
// Next, we are removing those 10 units from total units
Amount = 60 + 80 + ((Units - 10) * 20);
Ser_Charge = 70;
} else if (Units <= 20) {
答案 0 :(得分:0)
检查您的单元/测试是否重复;如果它们是int,则将转换结果: 5.0-0.2 = 5