Question

Write a java program that prints the letters corresponding to the numbers on the telephone. So...

Write a java program that prints the letters corresponding to the numbers on the telephone. So if you were to enter 6 it should print MNO. Now since you do not know how to do a System.in just do you for the number 7.

So your code should be like

int numberEntered = 7;

String value;

swtich (numberEntered){

case 1: value = "Nothing definded for 1"; break;

case 2 : value = "A,B,C"; break

.....

.....

default: value = "Not defined"; break

}

Make sure your code is formatted.

Homework Answers

Answer #1
//PhoneLetters.java
public class PhoneLetters {
    public static void main(String[] args) {
        int numberEntered = 7;

        String value;

        switch (numberEntered){
            case 1: value = "Nothing definded for 1";break;
            case 2 : value = "A,B,C"; break;
            case 3 : value = "D,E,F"; break;
            case 4 : value = "G,H,I"; break;
            case 5 : value = "J,K,L"; break;
            case 6 : value = "M,N,O"; break;
            case 7 : value = "P,Q,R,S"; break;
            case 8 : value = "T,U,V"; break;
            case 9 : value = "W,X,Y,Z"; break;
            default: value = "Not defined"; break;
        }

        System.out.println(value);
    }
}

P,Q,R,S

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Java Write a program that prints the letters corresponding to the numbers on the telephone. So...
Java Write a program that prints the letters corresponding to the numbers on the telephone. So if you were to enter 6 it should print MNO. Now since you do not know how to do a System.in just do you for the number 7. So your code should be like int numberEntered = 7; String value; swtich (numberEntered){ case 1: value = "Nothing definded for 1"; break; case 2 : value = "A,B,C"; break ..... ..... default: value = "Not...
PYTHON 3 Write a program that prints the count of all prime numbers between A and...
PYTHON 3 Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 21212 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules: You should first...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers...
C++ PROGRAM. (C++ INTRO QUESTION) Write a program that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = 55000 B = A + 5000 Just a recap on prime numbers: A prime number is any number, greater or equal to 2, that is divisible ONLY by 1 and itself. Here are the first 10 prime numbers: 2, 5, 7, 11, 13, 17, 19, 23, and 29. Rules:...
Complete the Java code. The code should print “x is in numbers” if the integer x...
Complete the Java code. The code should print “x is in numbers” if the integer x is one of the values stored in numbers. If x is not in numbers, your code should print “x is not in numbers” public static void main(String[] args){                         int[] numbers = <some array values>;                         int x = <some value>;             }
Complete the Java ocode. The code should print how many times integer x appears in numbers....
Complete the Java ocode. The code should print how many times integer x appears in numbers. For example, if numbers = {2,2,1,3,2,2} and x = 2, your code should print the number 4, because x appears 4 times in the array public static void main(String[] args){                         int[] numbers = <some array values>;                         int x = <some value>;             }
JAVA Write a program that will search a text file of strings representing numbers of type...
JAVA Write a program that will search a text file of strings representing numbers of type int and will write the largest and the smallest numbers to the screen. Include appropriate error handling in case a line contains more than one int or it contains a String. Wrap all the work you are doing with the file in a try/catch/finally block with appropriate "catch" sections; the finally block will be where you close your file object (if desired, look this...
problem 1 Write a program that asks the user for an integer and then prints out...
problem 1 Write a program that asks the user for an integer and then prints out all its factors. For example, when the user enters 84, the program should print 2 2 3 7 Validate the input to make sure that it is not a character or a string using do loop. in c plus plus
PP 8.2 Modify the program from PP 8.1 so that it works for numbers in the...
PP 8.2 Modify the program from PP 8.1 so that it works for numbers in the range between −25 and 25 THIS IS MY CODE! please edit this...Thank you import java.util.Scanner; public class Array { public static void main (String[] args) { Scanner scan = new Scanner (System.in); int[] integs = new int[51]; System.out.println("Enter integers 0-50 [enter -1 to quit]: "); int nums = scan.nextInt(); while (nums != -1 && nums>=0 && nums<=50) { integs[nums]++; nums = scan.nextInt(); } for...
Write a program that takes two numbers from the Java console representing, respectively, an investment and...
Write a program that takes two numbers from the Java console representing, respectively, an investment and an interest rate (you will expect the user to enter a number such as .065 for the interest rate, representing a 6.5% interest rate). Your program should calculate and output (in $ notation) the future value of the investment in 5, 10, and 20 years using the following formula: future value = investment * (1 + interest rate)year We will assume that the interest...
Write a java program to display a given range of integer numbers (0 to 9) in...
Write a java program to display a given range of integer numbers (0 to 9) in the following order: Example : given (5 to 9), the program displays 56789 67895 78956 89567 95678 The first line displays the min to max range. Each line that follows should display the next higher number except when it hits the maximum number. In that situation, the line wraps back to the minimum sequence. For this problem write a static method to do the...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT