#How to print this pattern using double dimensional array
65 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @civic cave! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I need help for both the patterns, never seen something like this before
let's do the second one first, that one's easier
what's the pattern there?
not as in "rectangle", but in rows and columns
the rows need to be the length of the word for example if the length of word entered by user is 7 so there needs to be 7 rows (eg: tuesday, so the rows need to be spelled as tuesday)
as for the columns i think we can do double number of rows
You can use the .repeat method and put your length
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
actually thing is im in senior year of school and my school syllabus doesnt allow these methods
defeats the purpose of asking us to write the code
describe what the pattern is like in words
so the second one
is a rectangle
u accept word from user in the example of the picture i sent its happy
so essentially its like
the first row is supposed to be filled with the first letter of the word
and the number of times is supposed to be 2x the number of rows
so column = 2 x row
and the middle parts is supposed to be empty
these r the 2 patterns
what about the other rows?
yeah i know, you need to figure out what the patterns actually are, not just what they look like
they're blank
like
its all blank in the middle
.
no, put it in words
just like you've done for the first row
once you have those in words, you effectively have a concrete description of the pattern
you can then implement that
ok got it, lemme try it now
but wait before i attempt
how do i get the blank spaces in
that would be in the loop, you print a space for each character of the pattern you print
but you can ignore that for now, get the actual pattern down first
How do i even put the letters of the word in the rows
generally you can use loops for that
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
the thing is the word 'HAPPY' in this case
im not aware of how to like put it in the rows
like ik for the first row it'd be like extracting the first character and printing it and for last extracting the last character
you can loop over the string with String.length() and String.charAt(int index)
with a for loop, for example
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
i will work on it tom and ill let u know if i run into any problems
is dm'ing u an option? coz this post has been open for a while
no
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
i will look into it, no point in opening this post for so long
got an idea from what u said
thnx for the help much appreciated