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.
//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
Get Answers For Free
Most questions answered within 1 hours.