Any ideas how to write Java program in a class named Window that produces the preceding figure as output. I have to use nested for loops to print the repeated parts of the figure. I've tried lots of times, no success :(
Write a Java program in a class named Window that produces the preceding figure as output. Use nested for loops to print the repeated parts of the figure. Once you get it to work, add one class constant to your program so that the size of the figure can be changed simply by changing that constant's value. The example output shown is at a constant size of 3, but if you change the constant, the figure should grow larger and wider proportionally.
+===+===+
| | |
| | |
| | |
+===+===+
| | |
| | |
| | |
+===+===+
OK i've got this, but still need to get rid of 3 bottom lines - any idea?
for (int i = 1; i <= 3; i++) {
for (int plus = 1; plus <= 2; plus++) {
System.out.print("+");
for (int shave = 1; shave <= 3; shave++) {
System.out.print("=");
}
}
System.out.print("+");
System.out.println();
for (int time = 1; time <= 3; time++) {
for (int kav = 1; kav <= 3; kav++) {
System.out.print("|");
for (int rev = 1; rev <= 3; rev++) {
System.out.print(" ");
}
}
System.out.println();
}
}
}