Question: Write a java program and create JUnit test class: Extracts a phone number (with area code) from this String and returns it in a standard

Write a java program and create JUnit test class:

Extracts a phone number (with area code) from this String and returns it in a standard format with the area code in parenthesis followed by a then a dash separating the third and fourth digits "(000) 000-0000" space if this string does not contain exactly 10 digits, returns the message "This WackyString is not a phone number." Note: any characters that are not digits should not be included in the returned string. For example: "Office phone: 804-828-7135" --> "(804) 828-7135"

* @return String containing the formatted phone number

String standardizePhoneNumber();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!