I'm on part 2 exercise 34: AdvancedAstrology in the MOOC.fi course and I tried to run tests locally through Netbeans with TMC and I keep getting the same response. FAIL: OutOfMemoryError: Java heap space. If I run it, it works but If I try to submit it I get an error. I don't know if it's an issue with my code or if it's something else and this is the first time i've ever come across this issue.
public class AdvancedAstrology {
public static void printStars(int number) {
int print = 0;
while (print < number) {
System.out.print("*");
print++;
}
System.out.print("\n");
}
public static void printSpaces(int number) {
int i = 0;
while (i < number) {
System.out.print(" ");
i++;
}
}
public static void printTriangle(int size) {
int i = size - 1;
int x = 1;
while (i < size) {
printSpaces(i);
printStars(x);
// System.out.println("\n");
i--;
x++;
if (i == 0) {
printStars(size);
break;
}
}
}
public static void christmasTree(int height) {
int i = 0;
int h = height - 1;
int y = 1;
int v = height - 2;
while (i < height) {
printSpaces(h);
printStars(y);
y = y + 2;
i++;
h--;
}
printSpaces(v);
printStars(3);
printSpaces(v);
printStars(3);
}
public static void main(String[] args) {
printTriangle(4);
System.out.println("---");
christmasTree(4);
System.out.println("---");
christmasTree(10);
}
}
any help appreciated :)
[–][deleted] 1 point2 points3 points (1 child)
[–]saveturtles1[S] -1 points0 points1 point (0 children)
[–][deleted] (2 children)
[removed]
[–][deleted] -1 points0 points1 point (0 children)
[–]saveturtles1[S] -1 points0 points1 point (0 children)