All Packages Class Hierarchy This Package Previous Next Index
Class java.lancs.GroupOfPeople
java.lang.Object
|
+----java.lancs.GroupOfPeople
- public class GroupOfPeople
- extends Object
represents a group of people's surnames, ages and salaries
-
GroupOfPeople()
- constructor sets the number of people in the group to zero
-
addSurname(String)
- adds a surname to those held
-
getAge(int)
- extracts one of the ages held
-
getCount()
- returns number of surnames held
-
getSalary(int)
- extracts one of the salaries held
-
getSurname(int)
- extracts one of the surnames held
-
setAge(int, int)
- inserts an age among those held
-
setSalary(int, int)
- inserts a salary among those held
GroupOfPeople
public GroupOfPeople()
- constructor sets the number of people in the group to zero
getCount
public int getCount()
- returns number of surnames held
- Returns:
- the number of surnames
addSurname
public void addSurname(String s) throws Exception
- adds a surname to those held
- Parameters:
- s - the surname to add
- Throws: Exception
- thrown if there are too many surnames
setAge
public void setAge(int i,
int a) throws Exception
- inserts an age among those held
- Parameters:
- i - the age number (0 <= i < number of surnames)
- s - the age to add
- Throws: Exception
- thrown if the argument is out of range
setSalary
public void setSalary(int i,
int s) throws Exception
- inserts a salary among those held
- Parameters:
- i - the salary number (0 <= i < number of surnames)
- s - the salary to add
- Throws: Exception
- thrown if the argument is out of range
getSurname
public String getSurname(int i) throws Exception
- extracts one of the surnames held
- Parameters:
- i - the surname number (0 <= i < number of surnames)
- Returns:
- the specified surname
- Throws: Exception
- thrown if the argument is out of range
getAge
public int getAge(int i) throws Exception
- extracts one of the ages held
- Parameters:
- i - the age number (0 <= i < number of surnames)
- Returns:
- the specified age
- Throws: Exception
- thrown if the argument is out of range
getSalary
public int getSalary(int i) throws Exception
- extracts one of the salaries held
- Parameters:
- i - the salary number (0 <= i < number of surnames)
- Returns:
- the specified salary
- Throws: Exception
- thrown if the argument is out of range
All Packages Class Hierarchy This Package Previous Next Index