Klein Prep Computer Science
**********
**********

Nested Loops Demo in Java

Specification Sheet

Program Title: Nested Loops Demo
Purpose: Demonstrate the use of three nested loops in Java. The program will generate a grid-like output, iterating over three dimensions (e.g., rows, columns, and depth levels).
Input: None (all values are pre-defined).
Output: Print a message indicating the iteration values for each loop (e.g., row, column, depth).
Behavior:

  1. The outer loop iterates over rows.
  2. The middle loop iterates over columns.
  3. The inner loop iterates over depth levels.
  4. The program prints the current iteration values for each dimension.

**********
**********

Pseudocode

START
DEFINE maxRow, maxCol, maxDepth as integers
SET maxRow = 3, maxCol = 3, maxDepth = 3

FOR row FROM 1 TO maxRow
    FOR column FROM 1 TO maxCol
        FOR depth FROM 1 TO maxDepth
            PRINT "Row: [row], Column: [column], Depth: [depth]"
        END FOR
    END FOR
END FOR
END
    
**********
**********

Google Classroom

• Your files will be:
	• PX_3Levels_lastname.java (java program)
	• PX_3Levels _lastname.png (Screen print)
	• PX_3Levels _lastname.mp4 (video of you running your program)
• Drop off all 3 files into google classroom.

    
**********
**********

Explanation

- Outer Loop (`row`): Controls the number of rows (first dimension).
- Middle Loop (`col`): Controls the number of columns (second dimension).
- Inner Loop (`depth`): Controls the depth levels (third dimension).
- The program prints all combinations of the indices (`row`, `col`, `depth`), resulting in maxRow * maxCol * maxDepth iterations.

**********
**********

Sample Output

Row: 1, Column: 1, Depth: 1
Row: 1, Column: 1, Depth: 2
Row: 1, Column: 1, Depth: 3
Row: 1, Column: 2, Depth: 1
Row: 1, Column: 2, Depth: 2
Row: 1, Column: 2, Depth: 3
Row: 1, Column: 3, Depth: 1
Row: 1, Column: 3, Depth: 2
Row: 1, Column: 3, Depth: 3
Row: 2, Column: 1, Depth: 1
... (continues until)
Row: 3, Column: 3, Depth: 3
    
**********
**********