Write a program that inputs a telephone number as a string


Write a program that inputs a telephone number as a string in the form (555) 555-5555. The program should use an object of class StringTokenizer to extract the area code as a token, the first three digits of the phone number as a token and the last four digits of the phone number as s token. The seven digits of the phone number should be concatenated into one string. The program should convert the area code string to int (remember ParseInt) and convert the phone number string to long. Both the area code and the telephone number should be printed. Remember that you will have to change delimiter characters during the tokenization process

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Write a program that inputs a telephone number as a string
Reference No:- TGS01186710

Now Priced at $10 (50% Discount)

Recommended (98%)

Rated (4.3/5)