All pastes #200460 Raw Edit

Miscellany

public text v1 · immutable
#200460 ·published 2006-10-13 05:19 UTC
rendered paste body
/**
 * Person2 class
 * Holds information about a person, their name, address, and phone number
 */
public class Person2
{
    /* instance variables */
	private String familyName;
    private String givenName;
	private Phone1 homePhone;
    private Address1 homeAddress;

	public Person2()
	{
		homePhone = new Phone1();
        homeAddress = new Address1();
	}

    /**
     * @return A string containing the name, address, and phone number
     */
	public String formatDisplay()
	{
		return     "+++Person2+++" + "\n"
             + familyName + " " + givenName + "\n"
             + homeAddress.formatDisplay() + "\n"
             + homePhone.formatDisplay() + "\n"
             + "+++++end of Person2+++++";
    }

    /**
     * @return A return code, 0 for no errors, non-zero for errors
     */
	public int update(String fam, String given, String area, String exchange,
                      String local, String number, String street, String city,
                      String prov, String postcode, String country)
	{
		familyName = new String (fam);
		givenName = new String(given);
        homePhone.update(area, exchange, local);
        homeAddress.update(number, street, city, prov, postcode, country);
    	return 0;
	}
}