class Person
{
# name : String
# address : String
# phone : String
# email : String
+ Person ()
+ Person ( name : String, address : String,
phone : String, email : String )
+ getName () : String
+ getAddress () : String
+ getPhone () : String
+ getEmail () : String
+ setName ( name : String )
+ setAddress ( address : String )
+ setPhone ( phone : String )
+ setEmail ( email : String )
+ toString () : String
}
class Student extends Person
{
- status : String
+ Student ()
+ Student ( name : String, address : String, phone : String,
email : String, status : String )
+ getStatus () : String
+ setStatus ( status : String )
+ toString () : String
}
class Employee extends Person
{
# office : String
# salary : double
# hiringDate : String
+ Employee ()
+ Employee ( name : String, address : String, phone : String,
email : String, office : String, salary : double,
hiringDate : String )
+ getOffice () : String
+ getSalary () : double
+ getHiringDate () : String
+ setOffice ( office : String )
+ setSalary ( salary : double )
+ setHiringDate ( hiringDate : String )
+ toString () : String
}
class Faculty extends Employee
{
- officeHours : String
- rank : String
+ Faculty ()
+ Faculty ( name : String, address : String, phone : String,
email : String, office : String, salary : double,
hiringDate : String, officeHours : String,
rank : String )
+ getOfficeHours () : String
+ getRank () : Sring
+ setOfficeHours ( officeHours : String )
+ setRank ( rank : String )
+ toString () : String
}
class Staff extends Employee
{
- title : String
+ Staff ()
+ Staff ( name : String, address : String, phone : String,
email : String, office : String, salary : double,
hiringDate : String, title : String )
+ getTitle () : String
+ setTitle ( title : String )
+ toString () : String
}
You will write a driver to test some of the classes in the inheritance hierarchy starting with Person. The class will be called TestPerson
public class TestPerson
{
public static void main ( String[] args )
{
Student aStudent = new Student ();
aStudent.setName ( "Ferris Bueller" );
aStudent.setAddress ( "123 Main St." );
aStudent.setPhone ( "512-174-1212" );
aStudent.setEmail ( "buellerf@mail.utexas.edu" );
aStudent.setStatus ( "freshman" );
System.out.println ( aStudent );
Staff aStaff = new Staff ( "Jane Doe", "789 First Ave",
"512-442-1411", "doej@mail.utexas.edu",
"MAI 3.56", 60000.00, "01 Sep 1991",
"Manager" );
System.out.println ( aStaff.getName() + " has an office at " +
aStaff.getOffice() );
aStaff.setTitle ( "Senior Manager" );
System.out.println ( aStaff );
}
}
The file that you will be turning in will be called TestPerson.java. You will follow the standard Java coding convention that I have appended below. The file will have a header of the following form:
/* File: TestPerson.java Description: Student Name: Student UT EID: Course Name: CS 303E Unique Number: TA: Date Created: Date Last Modified: */
You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code.
Use the turnin program to submit your TestPerson.java file. The TAs should receive your work by 5 PM, Friday, 07 May 2004.