Question
The international standard letter/number mapping for telephones is as follows: number 2 maps to letters a,b,c number 3 maps to letters d,e,f number 4 maps
The international standard letter/number mapping for telephones is as follows:
number 2 maps to letters a,b,c number 3 maps to letters d,e,f number 4 maps to letters g,h,i number 5 maps to letters j,k,l number 6 maps to letters m,n,o number 7 maps to letters p,q,r,s number 8 maps to letters t,u,v number 9 maps to letters w,x,y,z
Design and implement a Java program (name it KeyPad) that defines the following methods:
Method getNumber() takes uppercase letter as a parameter and returns the corresponding integer number according to the above mapping (int getNumber (char uppercaseLetter).
The main method askes the user to enter a phone number (as a string value) with letters, and then uses method getNumber() to convert the letters into digits and printout the phone number in digits. Design the main method such that it allows the user to re-run the program with different inputs (as we did in the previous assignment using a loop structure).
Document your code and organize the outputs properly using escape characters as shown below.
Enter phone number: 1-800-GMCARS7 You entered: 1-800-GMCARS7 Phone Number: 1-800-4622777
Enter phone number: 770-KSU-CCSE You entered: 770-KSU-CCSE Phone Number: 770-578-2273
Enter phone number: 770-ksuccse You entered: 770-ksuccse Phone Number: 770-5782273 Enter phone number: (770) KSU-CCSE You entered: (770) KSU-CCSE Phone Number: (770) 578-2273
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started