1 Contact Task Public Class Contact Implements Comparable Single Parameterized Constructor Q37049762

1. Contact Task:

public class Contact implements Comparable<Contact> :

  • A single parameterized constructor which receive 3 Stringparameters and use those values to initialize the 3 instancevariables defined by the class.
  • Accessor methods (get/set) for the instance variables asfollows: getName, getEmail, getPhone, setEmail, and setPhone. Onlya get method is needed for the name field (names cannot be changedafter a contact is created), while both set and get methods areexpected for both phone and email.
  • @Override public String toString() : returns a string in theformat “NAME, email: EMAIL, phone:PHONE.”. Note the dot “.” At the end of the line.
  • @Override public int compareTo(Contact c) This
    OR
    OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.