title: Comparing names in an address book program
body: <p>I'm doing an address book as part of a school assignment and I have it mostly figured out, but I'm stuck on one part. Here's my code first. I have an AddressBook class that contains variables and appropriate getter and setter methods to change/return the information for each person in the book. Then I have a TestAddressBook class with a method main that demonstrates how to address book works. The only thing I'm stuck on is the final requirement, where I'm asked to compare two names and see if they're equal. Here's the code for the classes.</p>
  
  <pre><code>public class AddressBook {
  
  private String firstName;
  private String middleName;
  private String lastName;
  private String homeAddress;
  private String homePhone;
  private String cellPhone;
  private String businessPhone;
  private String skypeId;
  private String facebookId;
  private String personalWebSite;
  
  public AddressBook(String firstName, String middleName, String lastName,
                     String homeAddress, String homePhone, String cellPhone,
                     String businessPhone, String skypeID, String facebookID,
                     String personalWebSite) {
  
                          this.firstName = firstName;
                          this.middleName = middleName;
                          this.lastName  = lastName;
                          this.homeAddress = homeAddress;
                          this.homePhone = homePhone;
                          this.cellPhone = cellPhone;
                          this.businessPhone = businessPhone;
                          this.skypeId = skypeID;
                          this.facebookId = facebookID;
                          this.personalWebSite = personalWebSite;
                          }
  
  public String getFirstName() {
      return firstName;
  }
  
  public void setFirstName(String firstName) {
      this.firstName = firstName;
  }
  
  public String getMiddleName() {
      return middleName;
  }
  
  public void setMiddleName(String middleName) {
      this.middleName = middleName;
  }
  
  public String getLastName() {
      return lastName;
  }
  
  public void setLastName(String lastName) {
      this.lastName = lastName;
  }
  
  public String getHomeAddress() {
      return homeAddress;
  }
  
  public void setHomeAddress(String homeAddress) {
      this.homeAddress = homeAddress;
  }
  
  public String getHomePhone() {
      return homePhone;
  }
  
  public void setHomePhone(String homePhone) {
      this.homePhone = homePhone;
  }
  
  public String getCellPhone() {
      return cellPhone;
  }
  
  public void setCellPhone(String cellPhone) {
      this.cellPhone = cellPhone;
  }
  
  public String getBusinessPhone() {
      return businessPhone;
  }
  
  public void setBusinessPhone(String businessPhone) {
      this.businessPhone = businessPhone;
  }
  
  public String getSkypeId() {
      return skypeId;
  }
  
  public void setSkypeId(String skypeId) {
      this.skypeId = skypeId;
  }
  
  public String getFacebookId() {
      return facebookId;
  }
  
  public void setFacebookId(String facebookId) {
      this.facebookId = facebookId;
  }
  
  public String getPersonalWebSite() {
      return personalWebSite;
  }
  
  public void setPersonalWebSite(String personalWebSite) {
      this.personalWebSite = personalWebSite;
  }
  
  public static String compareNames(String name1, String name2) {
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Then my test class...</p>
  
  <pre><code>public class TestAddressBook {
  
  public static void main(String[] args) {
  
      System.out.println("ENTRY 1");
  
      AddressBook name1 = new AddressBook("Robert", "James", "Smith", "3 Fake St", 
                                          "222-321-8371", "222-423-2382", 
                                          "222-438-2918", "bob483", "bobfb493",
                                          "http://www.freewebhost.com/bob848");
  
      System.out.println( "First Name:        " + name1.getFirstName() );
      System.out.println( "Middle Name:       " + name1.getMiddleName() );
      System.out.println( "Last  Name:        " + name1.getLastName() );
      System.out.println( "Address:           " + name1.getHomeAddress() );
      System.out.println( "Home Phone:        " + name1.getHomePhone() );
      System.out.println( "Cell Phone:        " + name1.getCellPhone() );
      System.out.println( "Business Phone:    " + name1.getBusinessPhone() );
      System.out.println( "Skype ID:          " + name1.getSkypeId() );
      System.out.println( "Facebook ID:       " + name1.getFacebookId() );
      System.out.println( "Personal Website:  " + name1.getPersonalWebSite() );
  
      System.out.println("\nENTRY 2");
  
      AddressBook name2 = new AddressBook("Bruce", "Allan", "Carter", "56 Outtamy Way", 
                                          "564-342-8372", "564-283-9832", 
                                          "564-293-3489", "brucie392", "brucieface28",
                                          "http://www.freewebhost.com/carteristheman");
  
      System.out.println( "First Name:        " + name2.getFirstName() );
      System.out.println( "Middle Name:       " + name2.getMiddleName() );
      System.out.println( "Last  Name:        " + name2.getLastName() );
      System.out.println( "Address:           " + name2.getHomeAddress() );
      System.out.println( "Home Phone:        " + name2.getHomePhone() );
      System.out.println( "Cell Phone:        " + name2.getCellPhone() );
      System.out.println( "Business Phone:    " + name2.getBusinessPhone() );
      System.out.println( "Skype ID:          " + name2.getSkypeId() );
      System.out.println( "Facebook ID:       " + name2.getFacebookId() );
      System.out.println( "Personal Website:  " + name2.getPersonalWebSite() );
  
      System.out.println("\nENTRY 3");
  
      AddressBook name3 = new AddressBook("Susan", "Anne", "Peters", "6 Madeup Blvd", 
                                          "736-453-1238", "736-392-2385", 
                                          "736-926-2439", "anniep", "susananne",
                                          "http://www.freewebhost.com/Susanspage");
  
      System.out.println( "First Name:        " + name3.getFirstName() );
      System.out.println( "Middle Name:       " + name3.getMiddleName() );
      System.out.println( "Last  Name:        " + name3.getLastName() );
      System.out.println( "Address:           " + name3.getHomeAddress() );
      System.out.println( "Home Phone:        " + name3.getHomePhone() );
      System.out.println( "Cell Phone:        " + name3.getCellPhone() );
      System.out.println( "Business Phone:    " + name3.getBusinessPhone() );
      System.out.println( "Skype ID:          " + name3.getSkypeId() );
      System.out.println( "Facebook ID:       " + name3.getFacebookId() );
      System.out.println( "Personal Website:  " + name3.getPersonalWebSite() );
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The assignment is asking for this...</p>
  
  <p>"Using the get and set methods, create a comparison method compareNames(name1, name2) that compares the first, middle, and last names of strings name1 and name2. Assume that name1 and name2 follow the following format: “FirstName M. LastName”."</p>
  
  <p>The assignment requires that the two strings be compared and return something along the lines of "Robert J. Smith and Bruce A. Carter are not equal names." Can anyone help with this?</p>