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


Constructor Index

 o GroupOfPeople()
constructor sets the number of people in the group to zero

Method Index

 o addSurname(String)
adds a surname to those held
 o getAge(int)
extracts one of the ages held
 o getCount()
returns number of surnames held
 o getSalary(int)
extracts one of the salaries held
 o getSurname(int)
extracts one of the surnames held
 o setAge(int, int)
inserts an age among those held
 o setSalary(int, int)
inserts a salary among those held

Constructors

 o GroupOfPeople
 public GroupOfPeople()
constructor sets the number of people in the group to zero

Methods

 o getCount
 public int getCount()
returns number of surnames held

Returns:
the number of surnames
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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