Question: Using Java Write a program that takes an input from the keyboard representing a telephone number The input will be valid if it contains 10
Write a program that takes an input from the keyboard representing a telephone number The input will be valid if it contains 10 digits that are optionaly separated by either space or hyphen after the first and the second block of three digits. For example all the following should be considered valid phone numbers 1234567890 123 4567890 123 456 7890 123-456-7890 123 456-7890 Validate the input with matches method and using a do-while loop keep prompting the user until the valid input is given Once you have a valid telephone number, you should assume that the digits (only the digits, not hyphen or space) may have been encrypted by shifting each number by a constant value. For instance, if the shift is 2, 0 becomes 2, 1 becomes 3, 2 becomes 4,..., 8 becomes 0, and 9 becomes 1 We know that the user is from New York where the decrypted area code (after the shift is applied), represented by the first three digits of the input, is 212 Your program needs to decrypt the telephone number and output the decrypted telephone number, as well as the shift value of the encyption. If there area code cannot be decrypted to 212, you should output that information instead
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
