Results 1 to 2 of 2
  1. #1
    ITnewbie is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Red face Recursive Star Pattern HELP PLEASE!!

    I need to create 4 sets of star patterns by only using a single System.out.print() command. I understand looping, but my issue is switching the pattern. They have to be as follows:
    Java Code:
    *                    **********  **********                    *
    **                  *********      *********                  **
    ***                ********         ********                 ***  
    ****              *******             *******               ****
    *****            ******                 ******             *****
    ******          *****                     *****           ******
    *******        ****                        ****          *******
    ********      ***                            ***        ********
    *********    **                                **      *********
    **********  *                                    *    **********
    I have the first two complete but cannot figure out how to get the last two without causing errors. Here's what I have so far. I'm just running them in an array instead of doing 4 seperate programs.
    Java Code:
    public class FormPattern{
    
    public static void main(String[] args){
    //a
    String star = "*";
    String [] starArray = newString[10];
         for (int i = 0; i < 10; i++);
           starArray[i] = star;
       System.out.print(star);
       System.out.println();
           star = star +"*";
    }
    //create space between patterns
       System.out.println();
       System.out.println();
    //b
          for (int i = 0; i < 10; i++){
            int j = 9 - i;
       System.out.print(starArray[j]);
       System.out.println();
    }
    This code will give me the first 2 patterns. My issue is getting the other two. I can't figure out how mirror them. Please help!!
    Thank you in advance!
    Last edited by Fubarable; 09-25-2009 at 11:00 PM. Reason: code tags added

  2. #2
    ITnewbie is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Default

    sorry about how close the patters are!! it didn't seem like it when i was writing this up!
    there are 10 lines in each and 4 total patters. they are side by side in the post. thank you!!

Similar Threads

  1. Star pattern help?
    By GeeKunMow in forum New To Java
    Replies: 13
    Last Post: 07-21-2011, 05:59 AM
  2. star icon
    By benkyma in forum Eclipse
    Replies: 1
    Last Post: 03-18-2009, 05:24 PM
  3. star array
    By nanna in forum New To Java
    Replies: 4
    Last Post: 11-23-2008, 07:58 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •