It's not a secret anymore!
The moose likes Beginning Java and the fly likes Please help me with this problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Please help me with this problem." Watch "Please help me with this problem." New topic

Please help me with this problem.

Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
I am suppose to write a program that will convert English to Morse code and Morse code to English. I am just terrible at this stuff and need a lot of help. Below is further instructions on my program.
INSY 3300/INSY 5309: Intermediate Computer Programming
Fall 2003
Due: Dec. 2 (Tuesday)
Programming Assignment #5: String Manipulation (20 points)
Complete Exercise 11.27 from the TextBook (p566-567).
o To convert Characters into MorseCode
o MorseToNormal: To convert MorseCode into Normal Characters
� You have to use String arrays which contain characters or morse code.
� You may use any kind of GUI such as JLabel, JTextField, JTextArea, or JButton.
� For, the program first determines whether the entered data are numbers or letters, using the following code:
char alpha //contain the first character of the input field Character.isDigit ( alpha)// return true if alpha is a number Character.isLettcr ( alpha)//return true if alpha is a letter
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24195

Well, break it down into pieces. I see three major chunks: the encoder, the decoder, and the GUI.
The encoder is easier. You just need an array holding the Morse code strings for each letter; encode a message by looking up each character one by one using its Unicode value (minus an appropriate offset) as an index.
The decoder is a little trickier; although the assignment implies you can do it the same way, and you could, I suppose, it's still a bit more complicated. Instead you'd have to do a linear search through the array of codes to find the letter.
Save the GUI until last, when the other stuff is tested and works.

[Jess in Action][AskingGoodQuestions]
Stephen Norris
Ranch Hand

Joined: Oct 27, 2003
Posts: 44
I swear that I pay attention in class, but that does not sound even close to familiar to me. I am just not sure what I am doing, but thank you for trying to help.
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
Ok ok, calm down first. You can't work or think if you panic. Sorry to tell this, I have no idea about mose code, but I am really sure if you help me in mose code I will certainly help you to write the program. I have some doubts, I will list them done.
1) Is there a mose code for every letter in the english alphbet?.
2) What about the spaces and the signs such as . , / *.
3) If you say 'hi' in english, do we have to convert letter by letter?.
I am sure if you answer these questions, I can certainly help you.
Keep cool....

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
I agree. Here's the link:
subject: Please help me with this problem.
It's not a secret anymore!