0

How to make endless switch in java?

19th Dec 2019, 7:30 AM
Nazar Tsiupak
Nazar Tsiupak - avatar
3 Respuestas
+ 2
I think you misunderstood the instruction a bit here buddy. The task asked you to write the code that repetitively asks for input (a character) and should output arrow symbol whose pointing direction depends on the character input. In this case, the loop may be said "endless" although not really. As you said, entering a Q character shall break the repetition, right?. So it is the input that runs in repetitions, not the `switch` conditional. Anyways, why not share what you have tried this far in your original question Description? I might be able to help once I see how far you have gone through and where you are stuck. Hopefully you didn't expect someone to write it down for you, as that will lessen your chance for learning : ) Looking forward to see your code 👍
19th Dec 2019, 4:40 PM
Ipang
+ 1
Here is the task: Write a program that will take characters in a loop: L U R D and output in response to the entered character - the corresponding arrow: ← ↑ → ↓ The cycle should end only when the Q character is entered. Use do while loops and switch constructs. Use char characters to display arrows. Symbols: ← '\ u2190' ↑ '\ u2191' → '\ u2192' ↓ '\ u2193'
19th Dec 2019, 2:11 PM
Nazar Tsiupak
Nazar Tsiupak - avatar
0
What is an "endless switch" anyway? I didn't get what you mean.
19th Dec 2019, 9:21 AM
Ipang