Edit: Figured it out, all is well.
------
Hi! I'm taking my first CS class and while I've got the hang of all the material so far, the nested for loops are giving me a bit of trouble. Well, quite frankly, they're pissing me off. :P I'm working on an assignment right now where I have to draw a rocket figure using for loops and I'm having problems with this one section of the figure. I get the feeling that there's a very obvious answer, but it just hasn't clicked. I was hoping someone might be kind enough to help get me back on track! Here's what I've got:
public class Rocket
{
public static void main (String[] args) {
Example();
drawLargeCone();
}
public static void Example() {
System.out.println(" /@@\\");
System.out.println(" //@@\\\\");
System.out.println(" ///@@\\\\\\");
System.out.println(" ////@@\\\\\\\\");
System.out.println("/////@@\\\\\\\\\\");
System.out.println();
}
public static void drawLargeCone() {
for (int line=5; line>=1; line--)
{
for (int k=1; k<=(line-1); k++)
{
System.out.print(" ");
}
for (int t=(5-(line-1)); t>=1; t--)
{
System.out.print("/");
}
{
System.out.println();
}
}
for (int i=1; i<=5; i++) {
System.out.print("@@");
for (int j=1; j<=i; j++) {
System.out.print("\\");
}
System.out.println();
}
}
}
The Example method is what it's
supposed to look like, but I can't get the two parts to match up. I'm pretty sure it's because the left aligned half with the "@@" and backslash are not within the same loop, but I don't see an obvious way to link the two together because the first outer loop is a decrementing for loop.
So, if anyone has any useful tips for me, I'd really appreciate it. Thanks!