All Packages Class Hierarchy This Package Previous Next Index
Class java.lancs.Person
java.lang.Object
|
+----java.lancs.Person
- public class Person
- extends Object
Represents simple facts about a person
-
FEMALE
- Constant - female gender
-
MALE
- Constant - male gender
-
UNKNOWN
- Constant - unknown gender
-
Person()
- Creates an instance of the Person class with default values
(forename = "NONE", surname = "NONE", age = 0, gender = UNKNOWN)
-
Person(String, String, int, int)
-
Creates an instance of the Person class with specified attribute
values
-
copy()
- return a copy of the person
-
formalTitle()
- return the formal title of the person
-
getAge()
- returns the age attribute of the person
-
getForename()
- returns the forename attribute of the person
-
getGender()
- returns the gender attribute of the person
-
getGenderString()
- returns the gender attribute of the person as a String
-
getSurname()
- returns the surname attribute of the person
-
getUpperAgeLimit()
- returns the upper limit for a valid age
-
increaseAge(int)
- increase the age of the person by the specified amount
-
setAge(int)
- set the age attribute of the person
-
setForename(String)
- set the forename attribute of the person
-
setFullName(String, String)
- set the full name of the person in one operation
-
setGender(int)
- set the gender atribute of the person
-
setSurname(String)
- set the surname attribute of the person
-
toString()
- return a string representing the person
UNKNOWN
public static final int UNKNOWN
- Constant - unknown gender
MALE
public static final int MALE
- Constant - male gender
FEMALE
public static final int FEMALE
- Constant - female gender
Person
public Person()
- Creates an instance of the Person class with default values
(forename = "NONE", surname = "NONE", age = 0, gender = UNKNOWN)
Person
public Person(String f,
String s,
int a,
int g)
- Creates an instance of the Person class with specified attribute
values
- Parameters:
- f - forename of the person
- s - surname of the person
- a - age of the person
- g - gender of the person
getUpperAgeLimit
public static int getUpperAgeLimit()
- returns the upper limit for a valid age
- Returns:
- the upper limit for a valid age
getForename
public String getForename()
- returns the forename attribute of the person
- Returns:
- the forename attribute of the person
getSurname
public String getSurname()
- returns the surname attribute of the person
- Returns:
- the surname attribute of the person
getAge
public int getAge()
- returns the age attribute of the person
- Returns:
- the age attribute of the person
getGender
public int getGender()
- returns the gender attribute of the person
- Returns:
- the gender attribute of the person
getGenderString
public String getGenderString()
- returns the gender attribute of the person as a String
- Returns:
- the gender attribute of the person as a String
setForename
public void setForename(String f)
- set the forename attribute of the person
- Parameters:
- f - the forename of the person
setSurname
public void setSurname(String s)
- set the surname attribute of the person
- Parameters:
- s - the surname of the person
setAge
public void setAge(int a)
- set the age attribute of the person
- Parameters:
- a - the age of the person
setGender
public void setGender(int g)
- set the gender atribute of the person
- Parameters:
- g - the gender of the person
increaseAge
public void increaseAge(int n)
- increase the age of the person by the specified amount
- Parameters:
- n - the number of years by which the age attribute should
be increased
setFullName
public void setFullName(String f,
String s)
- set the full name of the person in one operation
- Parameters:
- f - the forename of the person
- s - the surname of the person
formalTitle
public String formalTitle()
- return the formal title of the person
- Returns:
- the formal name of the person ('Mr' or 'Ms', initial, surname)
toString
public String toString()
- return a string representing the person
- Returns:
- details of the person ('forename surname (age: gender)')
- Overrides:
- toString in class Object
copy
public Person copy()
- return a copy of the person
- Returns:
- a copy of the Person instance
All Packages Class Hierarchy This Package Previous Next Index