Boolean and If Statement Homework
FRQs
public int getChargeStartTime(int chargeTime){
int startTime = 0;
for (int i = 1; i < 24; i++){
if (this.getChargingCost(i, chargeTime) < this.getChargingCost(startTime, chargeTime)){
startTime = i;
}
}
return startTime;
}
public boolean isStrictlyIncreasing(){
for (int i = 0; i < digitList.size()-1; i++){
if (digitList.get(i).intValue() >= digitList.get(i+1).intValue()){
return false;
}
}
return true;
}
public boolean evaluateLight(int row, int col) {
int onInCol = 0;
for (int r = 0; r < lights.length; r++) {
if (lights[r][col]) {
onInCol++;
}
}
if (lights[row][col] && onInCol % 2 == 0) {
return false;
} else if (!lights[row][col] && onInCol % 3 == 0) {
return true;
} else {
return lights[row][col];
}
}