Jeff Verdegan wrote:
So, 2 stars, then 6, then 10, and so on?
Time for some basic algebra. What's the equation for a line with the following points?
Jeff Verdegan wrote:Your first step is to write down in English, in very precise, simple steps, exactly how to do this "manually", without any regard to Java or any other programming language.
You might start with literal steps like, "Draw one star on the first line. Draw two stars on the second line," and so on. Then you might refine those steps as you discover the relationships between what goes where and which line you're on, for example, "Draw N stars on the Nth line." Once you've got that worked out, and you can follow the steps exactly as written with pencil and paper and get the result you want, then you're ready for the easy part--translating it to Java.
I would suggest two additional things:
1) Start with something simpler, like just a diamond of stars, without the border or box in the middle. If that proves troublesome, go simpler still, like a triangle of starts--1 on line 1, 2 on line 2, etc.--and then reverse that triangle so that the first line has a bunch of spaces and then the single star on the left, and so on.
2) For each pattern that you do, start with a small number of rows, like 4 or 5. That will make it easier to work through by hand.
I know that may sound like a lot of extra work, but I promise you, it will pay off. If you just jump in head first and try to do it all at once by sitting down and typing public static void main(String args), you'll just be setting yourself up for frustration and spinning your wheel.s
Kemal Sokolovic wrote: OP has just earned a title of time waster (at my side). Even the old thread started by OP has been crossposted to other site, and that's not the way to say thanks to those who are trying to help.