0

alright ive been banging my head against a wall for three hours and i give up does anyone have a clue? the what im supposed to do is write a method named lotsOfStars that will accept two integers: the first integer indicates
the number of lines to print, the second the number of asterisks per line. The method should
print a rectangular arrangement of asterisks.

such as 3,4
****
****
****

5
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by petrisal
0

Hints:

for (the number of lines you are given to print){
-print a newline.
for (the number of asteriks per line){
-print one asterik. Do not print a newline.
}


You can do printing using System.out.println and System.out.print. The former will print a newline (same as hitting enter basically) and the latter will not print a newline.
}

-1

Indeed there must be the problem in using System.out.println instead of System.out.print in the inner loop.

0

Indeed there must be the problem in using System.out.println instead of System.out.print in the inner loop.

WHAT??

0

Indeed there must be the problem in using System.out.println instead of System.out.print in the inner loop.

What went wrong? I tried to guess the mistake the programmer (icke2433) might be making.

0
public static void lotsOfStars(int lines, int stars) {
        for (int i = 0; i < lines; i++) {
            for (int j = 0; j < stars; j++) {
                System.out.print("*");
            }
            System.out.print("\n");

        }
    }
This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.