Answered step by step
Verified Expert Solution
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:
Question:
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started