Design Recipe for Iterative Loops

Under construction

Algorithm
Figure out how you would solve the problem yourself, if there were no such thing as a computer. Write this down as clearly and unambiguously as possible.

Define variables
Choose the variables that are important to the loop, including any values calculated by the loop, values modified by the loop, and values necessary to control the loop. Write down (in English) any relationships among these variables that should be true, e.g. "counter indicates the number of employees we've already examined, and lowPaid indicates how many of the first counter employees are paid less than $10/hour."
Write loop skeleton
The syntactic form of most while-loops (the most common kind) in Java is pretty much the same:
declarations and initialization
while (condition) {
      body
      }
clean-up and summary

Last modified: Wed Mar 10 10:24:43 EST 1999
Stephen Bloch / sbloch@boethius.adelphi.edu