Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

telephonefile_P2: The pointy-haired manager\'s secretary, Pat, keeps a telephone

ID: 3870917 • Letter: T

Question

telephonefile_P2:

The pointy-haired manager's secretary, Pat, keeps a telephone directory for him. But Pat mixes up local phone numbers, long distance phone numbers, and even international numbers in it. Worse, Pat has no common method of entering numbers, some area codes are surrounded by ( ), some are not. Some numbers have a space between them, others a dash. The pointy-hair manager only wants to see the file with the names and their North American number plan numbers in it – the familiar seven digit number. (Those are numbers that end with 3 numbers, a space or dash, and then 4 numbers). Work out a command structure that can be issued to the file telephonefile_P2, that returns the following:

Sam Spade (212)-756-1045

Daffy Duck 312 450 2856

Mom 354-2015

Lolita Spengler (816) 756 8657

Dr. Harold Kranzler 765-986-9987

Ralph Spoilsport's Motors 967 882 6534

Sister Sue 978 0672

JCCC 913-469-8500

Explanation / Answer

Java Program :

Class NumberParser{

//Method function : Input : telephonefile_P2

public void AmericanNumberParser(File file){

System.out.println(content);

}

}

}

}

You have to use imports libraries to run this java code. If it throws exception surround the code with try catch block.