# Thread: Developing a program that inputs telephone numbers

1. Member
Join Date
Jan 2014
Posts
2
Rep Power
0

## Developing a program that inputs telephone numbers

Develop an algorithm for a Java program that takes as input a single letter and displays the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way: 2 = ABC 3 = DEF 4 = GHI 5 = JK 6 = MNO 7 = PQRS 8 = TUV 9 = WXYZ

The screen dialog might look like this: Enter a single letter, and I will tell you what the corresponding digit is on the telephone. R The digit 7 corresponds to the letter R on the telephone.

The program should display a message indicating that there is no matching digit for any non-alphabetic character entered by the user. Also, the application should recognize only uppercase letters. If a user enters a lowercase letter, the program should display an error message. Prompt the user with an informative message for the input value as shown above.

The application should include the input letter as part of the output.

Write the algorithm to solve this problem including steps for prompting the user, getting input from the keyboard, and displaying the results.

Write the Java program that you designed, using your algorithm as a guide. Use your algorithm as comments in the body of the main method.

Use proper indentation, and meaningful identifiers throughout the code.

2. Member
Join Date
Jan 2014
Posts
2
Rep Power
0

## Developing a program that inputs telephone numbers

Develop an algorithm for a Java program that takes as input a single letter and displays the corresponding digit on the telephone. The letters and digits on a telephone are grouped this way: 2 = ABC 3 = DEF 4 = GHI 5 = JK 6 = MNO 7 = PQRS 8 = TUV 9 = WXYZ

The screen dialog might look like this: Enter a single letter, and I will tell you what the corresponding digit is on the telephone. R The digit 7 corresponds to the letter R on the telephone.

The program should display a message indicating that there is no matching digit for any non-alphabetic character entered by the user. Also, the application should recognize only uppercase letters. If a user enters a lowercase letter, the program should display an error message. Prompt the user with an informative message for the input value as shown above.

The application should include the input letter as part of the output.

Write the algorithm to solve this problem including steps for prompting the user, getting input from the keyboard, and displaying the results.

Write the Java program that you designed, using your algorithm as a guide. Use your algorithm as comments in the body of the main method.

Use proper indentation, and meaningful identifiers throughout the code.

3. ## Re: Developing a program that inputs telephone numbers

4. ▼ dafuq did I do?
Join Date
Dec 2013
Posts
204
Rep Power
0

## Re: Developing a program that inputs telephone numbers

Are you really trying to get someone to write this for you?

5. ## Re: Developing a program that inputs telephone numbers

6. Señor Member
Join Date
Jan 2014
Posts
184
Rep Power
0

## Re: Developing a program that inputs telephone numbers

Well, if you actually want help, go google these:

java.util.Scanner

switch statements

forloops

Should get you what you need.

In a forloop, ask for first letter, then save it to a char. Use a switch statement with cases to turn it into numbers.

If you actually want a finished code - go home. You won't get one.

7. ## Re: Developing a program that inputs telephone numbers

I'd build something around this:

Java Code:
```String key= "ABCDEFGH ...";
int[] val= { 2, 2, 2, 3, 3, 3 ... };```
kind regards,

Jos

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•