home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
WDESAMPL.BIN
/
Employee.java
< prev
next >
Wrap
Text File
|
1997-08-23
|
990b
|
49 lines
/**
* A completely constructed employee data object.
*/
public class Employee
{
public Name name;
public Section section;
public SSN ssn;
final static int NAME_FLD = 0;
final static int AGE_FLD = 1;
final static int SSN_FLD = 2;
public Employee(Name n, Section a, SSN s)
throws InvalidEmployeeException
{
name = n;
if (!name.isValid()) throw new InvalidEmployeeException();
section = a;
if (!section.isValid()) throw new InvalidEmployeeException();
ssn = s;
if (!ssn.isValid()) throw new InvalidEmployeeException();
}
public Employee(String n, String a, String s)
throws InvalidEmployeeException
{
this(new Name(n), new Section(a), new SSN(s));
}
public String toString()
{
String s;
s = (name.value()).trim();
s += " ";
s += (String.valueOf(section.value())).trim();
s += " ";
s += (ssn.value()).trim();
s += "\r\n";
return s;
}
}
/**
* A state-ful list of employee data objects.
*/