In: Computer Science
public class RocketDraw {
public final static int n = 3;
public static void main(String[] args) {
int i;
for (i = 0; i < n * 2 - 1; i++)
System.out.println(nTimes("", (n * 2 - i - 1)) + nTimes("/", (i + 1)) + "**" + nTimes("\\", (i + 1)));
System.out.println('+' + nTimes("*=", (n * 2)) + '+');
for (i = 0; i < n; i++)
System.out.println('I' + nTimes(".", (n - i - 1)) + nTimes("/\\", (i + 1)) + nTimes(".", ((n - i - 1) * 2)) + nTimes("/\\", (i + 1)) + nTimes(".", (n - i - 1)) + '|');
for (i = 0; i < n; i++)
System.out.println('|' + nTimes(".", i) + nTimes("\\/", (n - i)) + nTimes(".", (i * 2)) + nTimes("\\/", (n - i)) + nTimes(".", i) + '|');
System.out.println('+' + nTimes("*=", (n * 2)) + '+');
for (i = 0; i < n; i++)
System.out.println('|' + nTimes(".", i) + nTimes("\\/", (n - i)) + nTimes(".", (i * 2)) + nTimes("\\/", (n - i)) + nTimes(".", i) + '|');
for (i = 0; i < n; i++)
System.out.println('|' + nTimes(".", n - i - 1) + nTimes("/\\", (i + 1)) + nTimes(".", ((n - i - 1) * 2)) + nTimes("/\\", (i + 1)) + nTimes(".", (n - i - 1)) + '|');
System.out.println('+' + nTimes("*=", (n * 2)) + '+');
for (i = 0; i < n * 2 - 1; i++)
System.out.println(nTimes("", (n * 2 - i - 1)) + nTimes("/", (i + 1)) + "**" + nTimes("\\", (i + 1)));
}
public static String nTimes(String s, int n) {
String res = "";
for (int i = 0; i < n; i++) {
res += s;
}
return res;
}
}
Explanation
-> There was an extra closing bracket
-> There was one extra call accidentally
Please up vote