Phone Number Exchanges

I need a java program that uses a string tokenizer class to identify parts of a phone number?

Write a class that uses the StringTokenizer class to identify
the parts of a phone number. Assume that the format of the phone
number is (nnn) nnn-nnnn. Example (860) 222-3344. The class should
have at least three public methods: one returning the area code,
one returning the exchange and one returning the extension.

Here is how you would use the StringTokenizer

String no = “(860) 222-3344”;
StringTokenizer tokenizer = StringTokenizer(no, “() -“);

Then to get the individual tokens you would do this.

String areaCode = tokenizer.nextToken();
String exchange = tokenizer.nextToken();
String extension = tokenizer.nextToken();

You should be able to work out the rest.