Results 1 to 2 of 2
- 09-25-2009, 09:54 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 2
- Rep Power
- 0
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:
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:* ********** ********** * ** ********* ********* ** *** ******** ******** *** **** ******* ******* **** ***** ****** ****** ***** ****** ***** ***** ****** ******* **** **** ******* ******** *** *** ******** ********* ** ** ********* ********** * * **********
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!!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(); }
Thank you in advance!Last edited by Fubarable; 09-25-2009 at 11:00 PM. Reason: code tags added
- 09-25-2009, 09:55 PM #2
Member
- Join Date
- Sep 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
Star pattern help?
By GeeKunMow in forum New To JavaReplies: 13Last Post: 07-21-2011, 05:59 AM -
star icon
By benkyma in forum EclipseReplies: 1Last Post: 03-18-2009, 05:24 PM -
star array
By nanna in forum New To JavaReplies: 4Last Post: 11-23-2008, 07:58 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks