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...
Write a program in python that prints the count of all prime numbers between A and...
Write a program in python that prints the count of all prime numbers between A and B (inclusive), where A and B are defined as follows: A = The 5 digit unique number you had picked at the beginning of the semester 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,...
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>;             }
The ability to read through Java™ code and predict the results, given specific inputs, is an...
The ability to read through Java™ code and predict the results, given specific inputs, is an extremely useful skill. For this assignment, you will be analyzing the Java™ code in the linked zip file, and predicting the results given specific input. Carefully read through the code line by line, then answer the following questions in a Microsoft® Word document: What is the output of the program as it is written? What would the output of the program be if you...
write a program that prints all palindromic numbers between 0-9999 into the screen. Note :The code...
write a program that prints all palindromic numbers between 0-9999 into the screen. Note :The code should be written in java language.
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>;             }
Write a java program that calculates the number of duplicate words in a sentence. You may...
Write a java program that calculates the number of duplicate words in a sentence. You may assume that the input consists only 52 English characters with a single white-space as the separator between words (not punctuations in the inputted sentence). You need consider uppercase and lowercase letters the same. You may get the input from the keyboard. (You need to use Set and/or Hashset). What I have so far import java.util.HashSet; import java.util.Scanner; public class Duplicate { int counter; int...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT