Question: Write a java class encapsulating the concept of a telephone number, assuming a telephone number has only a single attribute: a string representing a telephone

Write a java class encapsulating the concept of a telephone number, assuming a telephone number has only a single attribute: a string representing a telephone number. include a construtor, accessor and mutator, and method toString and equals. Also include methods returnig the area code (the first three digits/characters of the phone number;if there are fewer than 3 characters in the phone number or if the first three are not digits, then this method should return "unknown area code"). write a client class to test all the methods in your class.

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!