Checklist for repetition Control 1. Watch out for the off-by-one error(OBOe) 2. Make sure the loop body contains a statement that will eventually cause the loop to terminate 3. Make sure the loop repeats exactly the correct number of times 4. If you want to execute the loop body N times, then initialize the counter to o and use the test condition counter n or initialize the counter to 1 and use the test condition counter < N C 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 7-11© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 7 - 11 Checklist for Repetition Control 1. Watch out for the off-by-one error (OBOE). 2. Make sure the loop body contains a statement that will eventually cause the loop to terminate. 3. Make sure the loop repeats exactly the correct number of times. 4. If you want to execute the loop body N times, then initialize the counter to 0 and use the test condition counter < N or initialize the counter to 1 and use the test condition counter <= N