So, I'm not exactly sure how to tackle this. I'm in the planning stage right now but my teacher isn't helping at all and I need to figure out how to code this.
I have to create two patterns (separate methods) that depend on user output between 2 and 10. I have to use some sort of loop (or multiple).
If the user entered four, this should be the output:
****
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
* *
****
Teacher said: The input of 4 means four stars in the first line, then down four lines with a star at each edge going wider, then four stars along another “edge” and then four more lines with a star at each edge coming closer together and then four stars on the last line centered.
I can't figure out how to calculate the number of spaces between each line and I honestly don't know how to put it in a loop.
Same goes for this one! Instead, I have to make an X.
This is the output if the user entered four:
X X
X X
X X
XX
XX
X X
X X
X X
Teacher said: The input of 4 has four rows moving together to for the top of the “x” (essentially a “V”) followed by the “inverse” of that shape for the bottom of the “X”
My teacher didn't teach us loops or syntax for Java or anything, he just gives us these assignments and expects us to know how to do them even though only one person in the class can actually code. Any kind of help would be appreciated! Thank you.
Aucun commentaire:
Enregistrer un commentaire