CS 1054: Laboratory Exercise 10

Objective

This exercise will introduce you to inheritance. Class behavior can be extended through inheritance.

To Receive Credit

Show the TA your working program before leaving class.

Activities

  1. Within Eclipse, create a new Project and call it Lab10. Within this project, you will create a bunch of different classes.
  2. Exercise 8.2: (The Person, Employee, Student, and MyDate classes) Implement a class named Person and two subclasses of Person named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number and e-mail address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employer has an office, salary, and date-hired. Define a class named MyDate that contains the fields year, month and day. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the person's name.
  3. To receive credit for this lab, just show the classes to the GTA. You will use these same classes in the final project. So make sure that you copy these files over to someplace where you can access them.

© Mir Farooq Ali 2005.