Results 1 to 7 of 7
  1. #1
    chrismb is offline Member
    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0

    Default 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. #2
    chrismb is offline Member
    Join Date
    Jan 2014
    Posts
    2
    Rep Power
    0

    Default 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. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,578
    Rep Power
    25

    Default Re: Developing a program that inputs telephone numbers

    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    zFollette is offline ▼ dafuq did I do?
    Join Date
    Dec 2013
    Posts
    203
    Rep Power
    0

    Default Re: Developing a program that inputs telephone numbers

    Are you really trying to get someone to write this for you?
    1000011 1100001 1101110 100000 1111001 1101111 1110101 100000 1110010 1100101 1100001 1100100 100000 1000010 1101001 1101110 1100001 1110010 1111001 111111

  5. #5
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    990
    Rep Power
    2

    Default Re: Developing a program that inputs telephone numbers

    You didn't even say "please".
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013

  6. #6
    AlexGraal is offline Señor Member
    Join Date
    Jan 2014
    Posts
    184
    Rep Power
    0

    Default 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. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,661
    Blog Entries
    7
    Rep Power
    21

    Default 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
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 26
    Last Post: 12-03-2013, 02:55 PM
  2. changing telephone numbers into words.
    By akeni in forum New To Java
    Replies: 20
    Last Post: 11-24-2011, 12:37 PM
  3. Sum positive numbers using 10 inputs from user
    By pvictory1 in forum New To Java
    Replies: 15
    Last Post: 10-10-2010, 01:30 AM
  4. how can I build a telephone program
    By m-i-l-s-o-n in forum New To Java
    Replies: 1
    Last Post: 09-22-2010, 02:31 AM
  5. temperature program with inputs
    By JingGong in forum New To Java
    Replies: 3
    Last Post: 10-17-2008, 06:34 PM

Posting Permissions

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