/**
 * An example that demonstrates the use of debug output statements
 * with loops
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class DebuggingLoops
{
    /**
     * The entry point.
     *
     * @param args  The command line arguments
     */
    public static void main(String[] args)
    {
        JMUConsole.open();

        int  i, n, number, total;

        total = 0;
        

        //[0
        // Prompt for 10 numbers and find the total
        i = 1;
        n = 10;

        // For debugging:
        JMUConsole.printf("i: %d   n: %d", i, n);
        while (i < n)
        {
            // For debugging:
            JMUConsole.printf("Iteration: %d", i);

            JMUConsole.printf("Enter a number: ");
            number = JMUConsole.readInt();

            // For debugging:
            JMUConsole.printf("  BEFORE total:%d number:%d", total, number);

            total = total + number;

            // For debugging:
            JMUConsole.printf("  AFTER total:%d number:%d", total, number);

            ++i;
        }
        //]0
        
        JMUConsole.close();
    }
}
