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:
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**********
• 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.**********
- 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.
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**********