package edu.columbia.cs.cs1007.company;

/**
 * The class Person contains information about a person's name, mailing address, and email.
 
 @author Julia Stoyanovich (jds2109@columbia.edu)
 *        COMS 1007, Summer 2009
 
 
 */

public class Person {
  
  // Instance variables
  private String _firstName;
  private String _lastName;
  private Address _address;
  private String _email;
  
  /**
   * Constructor method.
   @param firstName
   @param lastName
   @param address
   */
  public Person(String firstName, String lastName, Address address) {
    _firstName = firstName;
    _lastName = lastName;
    _address = new Address(address);
    _email = "";
  }

  /**
   * Constructor method.
   @param firstName
   @param lastName
   @param email
   @param address
   */
  public Person(String firstName, String lastName, String email, Address address) {
    _firstName = firstName;
    _lastName = lastName;
    _address = new Address(address);
    _email = email;
  }

  /** 
   * Constructor method.
   @param that - an instance of the class Owner.
   */
  public Person(Person that) {
    _firstName = that._firstName;
    _lastName = that._lastName;
    _address = new Address(that._address);
    _email = that._email;
  }
  
  /**
   * The Equals method that compares two instances of the class Person
   @param other - another instance of Person
   @return true if two instances have the same content, false otherwise.
   */
  public boolean equals(Object other) {
    Person that = (Personother;
    
    return (_firstName.equals(that._firstName&& 
        _lastName.equals(that._lastName&&  
        _email.equals(that._email&& 
        _address.equals(that._address));    
  }
  
  /** 
   * Generate a string representation of the person.
   @return stringRepresentation
   */
  public String toString() {
    String stringRepresentation = _firstName + " " + _lastName + " " + _email + "\n" + _address.toString();
    return stringRepresentation;
  }

  /**
   * Generate a short string representation of the Person.
   @return first name and last name
   */
  public String nameToString() {
    return _firstName + " " + _lastName;
  }
  
  public static void main(String[] args) {
    
    Person julia = new Person("Julia""Stoyanovich""jds2109@columbia.edu"
                  new Address("Amsterdam Avenue""1214""New York""NY""10027-7003"));
    System.out.println("Julia's information:\n" + julia.toString());
    
  }
}