Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int x = 0 ; x < sentence2.length () ; x++)
- {
- temp = sentence2.charAt (x);
- if (temp == ' ')// looks for a space
- {
- msentence2 = msentence2 + temp;
- }
- else if (temp == '.')// looks for a dot and adds it temp
- {
- temp2 = temp2 + temp;
- }
- else if (temp == '-')// looks for a dash and adds it to temp
- {
- temp2 = temp2 + temp;
- }
- else if (temp == ',')// looks for a comma
- {
- for (int y = 0 ; y < 26 ; y++)
- {
- if (temp2.equals (morse [y]))// translates the morse code character to an english character
- {
- temp = letters [y];
- msentence2 = msentence2 + temp;
- temp2 = "";// resets temp for next characters
- }
- }
- }
- }
- c.println (msentence2);// outputs sentence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement