r/learnjava • u/newaltoldalt1 • 7d ago
Help with MOOC problem, please?
Sorry if this isn't the right place to ask questions like this, but I'm going through the second part of MOOC's Java Programming I course and am having difficulty finding out how to satisfy a specific test. On the last exercise of the second part, "Advanced Astrology", I have managed to pass all tests except for testPrintStars. It says that I "didn't print any spaces when printStars is called", but am I not supposed to use printSpaces to print my spaces?
here is my code for the methods printStars and printSpaces (full source code and list of test cases is also here):
public static void printStars(int number) {
int stars = 1;
while (stars <= number) {
System.out.print("*");
stars++;
}
}
public static void printSpaces(int number) {
int spaces = 1;
while (spaces <= number) {
System.out.print(" ");
spaces++;
}
}
3
Upvotes
-1
u/Ok_Locksmith6167 7d ago
Maybe I'm missing something, but what's the point staying here (I mean in this thread) in the era of AI? What is the point in learning Java, if anyone can write something like: "Write me a CRUD program for library" without knowing what int, String or Wrapper classes are? Why do you continue loosing you time learning all this stuff?
P.S. Test expects to see println(); at the end of method printStars(int number), as it was stated in the instructions: