Convert letter in telefone numbers

Mar 5, 2008 at 11:29pm
I need help in my homework and can't find the beginning of my exercise. The exercise is:
Some companies use letters to show their telephone numbers. For example the number 438-5626 can be show as GET LOAN. Write a program that prompts the user to enter a telefone number expressed in letters and output the corresponding telephone number in digits. If the user enter more than 7 letters, then process only the first seven letters. Also output the - (hyphen) after the third digit. Allow the user to use both uppercase and lowercase letters as well as spaces between words. Moreover your program should process as meny telephone numbers as the user wants.

This exercise I understand that is a repeticion structure with nested I will apreciate your help!!!!!

Thanks
Last edited on Mar 6, 2008 at 12:20am
Mar 6, 2008 at 12:58am
Use a loop to ask for and convert telephone numbers until the user is done.

Inside that loop, once you have a telephone number, use another loop to convert each letter to a number. I would use either a look-up table to convert letters to numbers or a remainder operation (modulus operator %). 'S' and 'Z' are not on the telephone dial, but you can generally assume that they map to '7' and '9'.

Now, do your best and post back with code if you still need help.
Last edited on Mar 6, 2008 at 12:59am
Topic archived. No new replies allowed.