Morse code is a code where each letter of the English alphabet, each digit, and various punctuation characters are represented by a series of dots and dashes. Write a program that asks the user to enter a string, and then converts that string to Morse code. Use hyphens for dashes and periods for dots.
Breaking it down
In this exercise we will create a java hashmap and store the letter or digit as the key with the associated morse code as the value. We will ask the user to input a phrase, call toUpperCase() and loop through with java 8 foreach char element looking up the morse code value.
Create map
Main program
Output
Level Up
Verify what happens if someone enters a letter or a digit that isn't contained in the map. What should be the output to the user?