Class Human

java.lang.Object
  extended by Human

public class Human
extends java.lang.Object

A Human has a name and an age. A human's name can be changed at any time. A human's age only changes when the human has a birthday.


Constructor Summary
Human(java.lang.String initName)
          Creates a human with the given name.
 
Method Summary
 int getAge()
          Returns the age of this human.
 java.lang.String getName()
          Returns the name of this human.
 void haveBirthday()
          Causes the human to have a birthday (i.e., adds a year to the age).
 void setName(java.lang.String newName)
          Changes the name of this human to the new name given.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Human

public Human(java.lang.String initName)
Creates a human with the given name. The human starts out at age 0.

Parameters:
initName - the name to give the human
Method Detail

getName

public java.lang.String getName()
Returns the name of this human.

Returns:
the name of the human

getAge

public int getAge()
Returns the age of this human.

Returns:
the age of the human

setName

public void setName(java.lang.String newName)
Changes the name of this human to the new name given.

Parameters:
newName - the new name for the human

haveBirthday

public void haveBirthday()
Causes the human to have a birthday (i.e., adds a year to the age).