【发布时间】:2019-03-12 13:24:06
【问题描述】:
我想从当前读数中减少“以前的仪表读数”。但仍会针对当前读数进行账单计算。看起来很简单,但我找不到问题所在。
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) {
【问题讨论】:
-
您没有得到准确的输出吗?你有什么问题?请解释一下。
-
我想得到单位从当前单位减少以前的米单位。但只计算当前单位。
-
显示您的完整代码。告诉我 Units and Test 的数据类型是什么。
-
我无法添加完整的代码。 Bcoz 太大了。
-
抱歉,您没有很好地解释问题。
标签: android calculation