Unit 3 Boolean & If Statements
Avinh Huynh
public class BatteryCharger {
public int getChargeStartTime(int chargeTime) {
int chargeStartTime = getChargingCost(0, chargeTime);
for (int startHour = 0; startHour<=23; startHour++)
int newChargeTime = getChargingCost(startHour, chargeTime);
if (chargeStartTime > newChargeTime) {
chargeStartTime = newChargeTime;
}
return chargeStartTime;
}
}
public class Digits {
public boolean isStrictlyIncreasing() {
for (int i = 1; i < digitList.size(); i++) {
if (digitList.get(i-1).intValue() < digitList.get(i).intValue()) {
return true;
}
}
return false;
}
}
public boolean isBalanced(ArrayList<String> delimiters){
int count;
for (String delimiter : delimiters) {
if (delimiter.Equals(this.openDel)) {
count++;
} else {
count--;
}
}
if (count == 0) {
return true;
} else {
return false;
}
}