Advertisement
Guest User

Untitled

a guest
Oct 18th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. for (int x = 0 ; x < sentence2.length () ; x++)
  2. {
  3. temp = sentence2.charAt (x);
  4.  
  5. if (temp == ' ')// looks for a space
  6. {
  7. msentence2 = msentence2 + temp;
  8. }
  9. else if (temp == '.')// looks for a dot and adds it temp
  10. {
  11. temp2 = temp2 + temp;
  12. }
  13. else if (temp == '-')// looks for a dash and adds it to temp
  14. {
  15. temp2 = temp2 + temp;
  16. }
  17. else if (temp == ',')// looks for a comma
  18. {
  19.  
  20. for (int y = 0 ; y < 26 ; y++)
  21. {
  22. if (temp2.equals (morse [y]))// translates the morse code character to an english character
  23. {
  24. temp = letters [y];
  25. msentence2 = msentence2 + temp;
  26. temp2 = "";// resets temp for next characters
  27. }
  28. }
  29. }
  30.  
  31. }
  32. c.println (msentence2);// outputs sentence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement