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.
Code java:
<console
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#' >
I need help with a code template that i can use to come up with my own solution.
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 '
Quote:
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.
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.
Code java:
<console
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'
#'''#'''#'''#'''#'''#'>
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?