Results 1 to 3 of 3
  1. #1
    semh is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default Help with program please!

    I am not asking for the answer to this project, I am just stuck
    this is what I need:
    Java Code:
    *
    **
    ***
    ****
    *****
    ******
    *******
    ********
    *********
    
    *********
    ********
    *******
    ******
    *****
    ****
    ***
    **
    *
    
    *********
     ********
      *******
       ******
        *****
         ****
          ***
           **
            *
        
            *
           **
          ***
         ****
        *****
       ******
      *******
     ********
    *********
    All asterisks ( * ) should be printed by a single statement of the form System.out.print( ‘*’ ); which causes the asterisks to print side by side.

    A statement of the form System.out.println(); can be used to position to the next line.

    A statement of the form System.out.print( ‘ ‘ ); can be used to display a space for the last two patterns.

    There should no other output statements in the program.

    This is what I have right now, it makes the first one print

    Java Code:
    public class Pyramid {
    
    public static void main (String[] args)
    {
    final int MAX_ROWS = 10;
    
    for (int row = 1; row <= MAX_ROWS; row++)
    {
    for (int star = 1; star <= row; star++)
    System.out.print ("*");
    
    System.out.println();
    }
    }
    }
    I am not sure how to make the second, third and fourth appear. I make the code but it isnt showing.
    I am not sure what I am missing here
    if I am way off just tell me and Ill go back to the drawing board

    thanks

    again I am not looking for the answer just a little nudge in the right direction

    Moderator Edit: Code tags added for readability
    Last edited by Fubarable; 03-20-2010 at 03:01 AM. Reason: Moderator Edit: Code tags added for readability

  2. #2
    semh is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    crap it didnt print out right on here, the last two are suppose to have spaces before it

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I added code tags to help your output look right.

    I suggest that you post your code attempts to solve the three last patterns and let's see how we can work with it. Also, please use code tags when posting code (see my signature below) and please post properly indented code since code that's easier to read is code that gets read, and you want as many people reading your code and helping you as possible.

    Much luck and welcome to the forum!

Similar Threads

  1. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM
  2. Execute A program from a Program!
    By Moncleared in forum Advanced Java
    Replies: 2
    Last Post: 02-22-2009, 04:17 PM
  3. Executing a program within a program
    By gibsonrocker800 in forum New To Java
    Replies: 5
    Last Post: 05-12-2008, 08:24 AM
  4. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 09:33 PM

Posting Permissions

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