When I output pW it gives me the original value
double plateWt = wWeight - bWval;
while (plateWt > 200 && plate100val > 0) {
plateWt = plateWt - 200;
plate100 ++;
plate100val --;
}
while (plateWt > 90 && plate45val > 0) {
plateWt = plateWt - 90;
plate45 ++;
plate45val --;
}
while (plateWt > 70 && plate35val > 0) {
plateWt = plateWt - 70;
plate35 ++;
plate35val --;
}
while (plateWt > 50 && plate25val > 0) {
plateWt = plateWt - 50;
plate25 ++;
plate25val --;
}
while (plateWt > 20 && plate10val > 0) {
plateWt = plateWt - 20;
plate10 ++;
plate10val --;
}
while (plateWt > 10 && plate5val > 0) {
plateWt = plateWt - 10;
plate5 ++;
plate5val --;
}
while (plateWt > 5 && plateQval > 0) {
plateWt = plateWt - 5;
plateQ ++;
plateQval --;
}
Log.i("LOG_TAG", "PlateWeight value: " + plateWt);
double pw = plateWt;
warmupPlatesOneTextView.setText(String.valueOf(pw));
11-25 15:16:16.867: I/LOG_TAG(21569): PlateWeight value: 5.0
11-25 15:16:16.883: I/LOG_TAG(21569): PlateWeight value: 10.0
11-25 15:16:17.121: I/LOG_TAG(21569): PlateWeight value: 45.0
11-25 15:16:17.145: I/LOG_TAG(21569): PlateWeight value: 45.0
At a guess I’d say it’ll running correctly the first time (resulting in 5)
After that, assuming global variables, the while loops will not execute.
Stick a break point into the code and step through it to check