What is the error in this code??? | Sololearn: Learn to code for FREE!

+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

11/24/2019 10:33:01 AM

︻╦╤─♦งēຖ໐๓♠彡

4 Answers

New Answer

+1

https://code.sololearn.com/c55X0WSTZPgZ/?ref=app

+3

Thank you so much Sami Khan & ~swim~ for your answers. The program worked!!😃😃

+2

You need to put the whole switch in a loop. Currently the switch is statement is executed only once.

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;