Results 1 to 7 of 7
Thread: Morse code translation?
- 10-09-2011, 07:16 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 12
- Rep Power
- 0
Morse code translation?
Hey guys,
So I've been working on a code that allows for a user input of English to translate to morse code and a user input of morse code to translate to English. English to morse was easy enough, but morse to English is proving far more difficult. I'm not quite sure how to designate each morse 'letter' as its own, if you know what I mean. I feel the split method might be useful, because I could split the user input at each space or | character, but I'm not very good with coding a split and I keep getting a bunch of nonsense when I test my code.
Does anyone have an idea as to what I could do?
-
Re: Morse code translation?
Split could work well. Let's see sample input, your code, and your errors.
- 10-09-2011, 07:45 PM #3
Member
- Join Date
- Oct 2011
- Posts
- 12
- Rep Power
- 0
Re: Morse code translation?
String m;
m = Input.getString ( " Type a sentence in morse, separating spaces with a space. " );
String [] test = m.split(" ");
for ( int x = 0; x < test.length; x++ )
System.out.println( " Test is " + test[x] );
I tested a normal sentence first, like "Morse test", but I got back a bunch of gibberish. Something like [Ljava.lang.String;@16930e2. Perhaps I'm not using it correctly as an array?
- 10-09-2011, 08:27 PM #4
Member
- Join Date
- Oct 2011
- Posts
- 12
- Rep Power
- 0
Re: Morse code translation?
This didn't post the first time I tried, so I'll try again:
String m;
m = Input.getString ( " Type a sentence in morse, separating spaces with a space. " );
String [] test = m.split(" ");
for ( int b = 0; b < test.length; b++ )
{
System.out.println( " Test is " + test[b] );
}
I'm getting a bizarre [Ljava.lang.String error when I test this. My input, by the way, was "Morse Test". Any ideas? Perhaps I'm not formatting it correctly as an array?
-
Re: Morse code translation?
Show the exact error message please and which line causes it?
- 10-09-2011, 08:35 PM #6
Member
- Join Date
- Oct 2011
- Posts
- 12
- Rep Power
- 0
Re: Morse code translation?
[Ljava.lang.String;@16930e2
It actually says 'Test is' before that, so I know it's a problem with the second part of the print statement.
-
Re: Morse code translation?
Similar Threads
-
Morse Code Java Program - Help Needed Please!!
By dungeondragon in forum New To JavaReplies: 8Last Post: 02-25-2011, 04:36 AM -
Language translation
By archanaanbu in forum Java AppletsReplies: 13Last Post: 02-19-2011, 06:56 PM -
Language translation
By archanaanbu in forum Java AppletsReplies: 0Last Post: 02-09-2011, 05:21 AM -
Morse Code
By Jamison5213 in forum New To JavaReplies: 6Last Post: 04-14-2010, 04:56 AM -
WORD Translation HELP PLZ :(
By sammypants in forum New To JavaReplies: 2Last Post: 11-24-2009, 01:46 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks