Class Person

java.lang.Object
  extended byPerson

public class Person
extends java.lang.Object

The class Person represents a person having a name and address. The name and address are represented as strings. There is a method that allows changing the address, but the name cannot be changed.


Constructor Summary
Person()
          The default constructor initializes a person named "John Doe" in "New York City"
Person(java.lang.String n, java.lang.String a)
          This is the constructor that would normally be used to create a Person object.
 
Method Summary
 java.lang.String getAddress()
          The accessor function getAddress returns the person's address.
 java.lang.String getName()
          The accessor function getName returns the person's name.
 void setAddress(java.lang.String a)
          Sets the person's address.
 java.lang.String toString()
          Returns a string representing the person, consisting of the name followed by "/" followed by the address.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Person

public Person()
The default constructor initializes a person named "John Doe" in "New York City"


Person

public Person(java.lang.String n,
              java.lang.String a)
This is the constructor that would normally be used to create a Person object. It initializes the name and address from the calling parameters.

Parameters:
n - the person's name
a - the person's address
Method Detail

getName

public java.lang.String getName()
The accessor function getName returns the person's name.

Pre-condition: None.
Post-condition: Returns the name.

Returns:
the person's name

getAddress

public java.lang.String getAddress()
The accessor function getAddress returns the person's address.

Pre-condition: None.
Post-condition: Returns the address.

Returns:
the person's address

setAddress

public void setAddress(java.lang.String a)
Sets the person's address.

Pre-condition: None.
Post-condition: Changes the address.

Parameters:
a - the person's address

toString

public java.lang.String toString()
Returns a string representing the person, consisting of the name followed by "/" followed by the address.

Pre-condition: None.
Post-condition: Returns a string name + "/" + address.

Returns:
the string name + "/" + address