Click to See Complete Forum and Search --> : Please help with this method!


thekingjava123
May 6th, 2010, 01:16 AM
Write a public static method named starPrinter that will take an int as a parameter and
print lines of stars as shown below.

The header of the method will be public static void starPrinter(int n) .

e.g.
If the value of n is 5, then the method should print
*
***
*****
*******
*********

If the value of n is 3, then the method should print
*
***
*****

Please help!

thekingjava123
May 6th, 2010, 01:18 AM
It actually has to look like pyramid as opposed to evenly stacked

" *
" ***
" *****

thekingjava123
May 6th, 2010, 01:23 AM
A picture of how it is supposed to look is attached below

thekingjava123
May 6th, 2010, 01:31 AM
http://www.imgxc.com/fullimage/1eATfc.png

dlorde
May 6th, 2010, 05:02 AM
So what part of that is giving you trouble? We aren't going to write the code for you.

If you're having trouble with the algorithm, consider how you would write out the pattern by hand, character by character, line by line, using spaces and stars. Think about how the number of spaces and stars changes from line to line.

Technical skill is mastery of complexity, while creativity is mastery of simplicity...
E. C. Zeeman