Question: I would like some help in completing this exercise. Thank You public class Contact { /** * Add private instance variables here. See the class
I would like some help in completing this exercise. Thank You
public class Contact { /** * Add private instance variables here. See the class structure given in the * assignment description. */
/** * Implement your constructor here. Initialize the phoneNumber to null. */ public Contact(Name name) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }
/** * Implement your addPhoneNumber method here. * * 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 addPhoneNumber(String pNumber) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }
/** * Implement your toString method. The output should be in the format: * * Name: __________ (Phone Number: ___-___-____) * * For example, if a contact has the first name John, last name Doe and middle * name Xavier, and the phone number 123-456-7890, this should return: * * Name: Doe, John Xavier (Phone Number: 123-456-7890) * * Do not insert new line character after the last digit of the phone number. */ public String toString() { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }
/** * Implement your equals method here. * */ public boolean equals(Object obj) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
