Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Java Student. Need some help with a loop.

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Exclamation Java Student. Need some help with a loop.

    hey people,
    I have been trying to print out a loop that goes like this.

    But the thing is havent got a clue of what i am doing.
     
    	<console 
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#' >

    I need help with a code template that i can use to come up with my own solution.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,104
    Thanks
    48
    Thanked 2,153 Times in 2,126 Posts

    Default Re: Java Student. Need some help with a loop.

    Can you describe what the output should be? Is it just those 3 lines of alternating #" ending in a '

    havent got a clue of what i am doing.
    Can you describe in a list of short, simple, detailed steps what the program should do to print out the desired output.
    You need to understand the steps the program should take BEFORE you try to write any code.

    Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2012
    Posts
    17
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Java Student. Need some help with a loop.

    I want to print out a pattern.
    The patternis defined as one string character, this is repeated across the house with gaps in between.
    My assignment states . a house is 22 wide , 5 in length with the print patteren of '#' and the gap of 3.
    e.g.
     
     <console 
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'
    #'''#'''#'''#'''#'''#'>

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,104
    Thanks
    48
    Thanked 2,153 Times in 2,126 Posts

    Default Re: Java Student. Need some help with a loop.

    Can you list the steps the program needs to do to print out what you want printed?
    First how does it get the pattern, the length of a line and the number of lines?
    What does it need to do to print the contents of a line?
    What prints first? What is repeated on the line? What prints last on a line?
    Is the output the same for all the lines?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Beginner Java Student Having Some Trouble
    By csprung in forum Loops & Control Statements
    Replies: 1
    Last Post: April 25th, 2012, 08:14 AM
  2. New java student need help with code
    By Darkcore123 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 24th, 2011, 10:50 AM
  3. Student.java
    By ruffu054 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 12th, 2011, 02:40 PM
  4. i'm a fresh NIIT java student
    By femoozer in forum Member Introductions
    Replies: 2
    Last Post: August 20th, 2011, 02:12 PM
  5. Hello to all!/Java Student.
    By Benjamin Cainan in forum Member Introductions
    Replies: 1
    Last Post: May 3rd, 2011, 09:48 AM

Tags for this Thread