package edu.columbia.cs.cs1007.banking;
/**
* @author Julia Stoyanovich (jds2109@columbia.edu)
* COMS 1007, Summer 2009
*
* The class Person contains information about a person's name, mailing address, and email.
*
*/
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;
}
/**
* Generate a string representation of the person.
* @return stringRepresentation
*/
public String toString() {
String stringRepresentation = _firstName + " " + _lastName + " " + _email + "\n" + _address.toString();
return stringRepresentation;
}
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());
}
}
|