What is the error in this code??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the error in this code???

I have created a program on Morse code using switch case. Upon entering multiple letters, it prints the Morse code of only the first one. https://code.sololearn.com/c8Ih0bpblNmI/?ref=app https://code.sololearn.com/c8Ih0bpblNmI/?ref=app

24th Nov 2019, 10:33 AM
︻╦╤─♦งēຖ໐๓♠彡
︻╦╤─♦งēຖ໐๓♠彡 - avatar
3 Answers
+ 1
https://code.sololearn.com/c55X0WSTZPgZ/?ref=app
24th Nov 2019, 10:47 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 3
Thank you so much Sami Khan & ~swim~ for your answers. The program worked!!😃😃
24th Nov 2019, 1:00 PM
︻╦╤─♦งēຖ໐๓♠彡
︻╦╤─♦งēຖ໐๓♠彡 - avatar
0
use .toLowerCase(); and check only lower letters String s= n.nextLine().toLowerCase(); ... switch(s.charAt(g)) { //case 'A': case 'a': System.out.print ("•- ");break;
24th Nov 2019, 5:34 PM
zemiak