Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Background: Question: public class Contact Add private instance variables here. See the class structure given in the assignment description. private Name name private String phoneNumber;

Background:

image text in transcribed

image text in transcribed

Question:

image text in transcribed

public class Contact Add private instance variables here. See the class structure given in the assignment description. private Name name private String phoneNumber; Implement your constructor here. Initialize the phoneNumber to null. rt public Contact (Name name) phoneNumber -null; this.name-name; ImpLement your addPhoneNumber method here. rt The phone number should be in the format of three digits followed by a dash, *followed by another three digits, followed by a dash, and finally followed by four digits (i.e., 301-405-2755). Return false if the phone number format is *incorrect or null. public boolean addPhoneNumberCString pNumber) t if(pNumber.lengthO12) if(java. lang. Character. isDigit(pNumber.charAt(0)) && java.lang. Character. isDigit(pNumber.charAt(1)) && java.lang. Character.isDigit(pNumber.charAt(2)) && java.lang.Character.isDigit(pNumber.charAt(4))&&

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions