Computer Science

posted by .

I got part one but part 2 is confusing.
Part1:
Create a class called Person that has two subclasses Student and Employee. Make Faculty and Staff subclasses of Employee. A person has name and address. A student has GPA as a real number between 0.00 and 4.00. An employee has an office address and a salary. A faculty member has a rank. A staff member has a title. Create a toString method in each class that returns a description of the person, including the class name, the person's name and the values of all the other attributes of the object.
Create a test class that includes an array of persons containing at least one person from each of the subclasses. Then print out all objects in a loop.

Part2:
Now, add an abstract class Role that has no members. There are two subclasses of Role called EmployeeRole and StudentRole. Use the bodies of Employee and Student for those, as these classes are no longer needed. The Person class will have a list of roles, and a method addRole(Role r). Make FacultyRole and StaffRole subclasses of EmployeeRole as before. Add an abstract getPay method to EmployeeRole, and getPay() methods to StaffRole and FacultyRole. Make sure you have toString methods in FacultyRole and StaffRole, and that they are appropriately changed.

Change the tester to conform to the new requirements. You still need an array of persons, but you will need to add roles to each person. In addition to what you did in the previous homework, you should have at least one person who is both student and staff.

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Computer Science

    Write a Class to represent one of the following items. Note that each class must a proper constructor even though the constructor is not explicitly named. 2. Student that has a name, point and course count. The class should have methods …
  2. computer Programming

    A small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of hours …
  3. computer programming

    small startup software developer company needs to create a program that will calculate the pay of its employees. For the third version of the program, the company wants the program to accept an employee’s name, the number of hours …
  4. business accounting

    can someone help me with some information on each one of this. Employee Receives Either Rewards or Punishments Employee Identifies Need Employee searches for ways to satisfy these needs Employee Reassess Need Deficiencies Employee …
  5. business

    can someone help me with some information on each one of this. Employee Receives Either Rewards or Punishments Employee Identifies Need Employee searches for ways to satisfy these needs Employee Reassess Need Deficiencies Employee …
  6. business

    can someone help me with some information on each one of this. Employee Receives Either Rewards or Punishments Employee Identifies Need Employee searches for ways to satisfy these needs Employee Reassess Need Deficiencies Employee …
  7. computer science

    I need to see if someone can help me with a c# programming problem Create a class called employees that includes three pieces of information as either instance variables or automatic properties - a first name(type string), a last name …
  8. Java

    You are to create an efficient OO application to be used by the wait staff at the Mason Inn. You will process one waiter/waitress at a time. The user will provide information for him or her, to include: their name, number of hours …
  9. Language arts

    Not sure if I'm correct . 2. What do facial features in the poem diondra Jordan symbolize ?
  10. computer,science, java

    Inorder to motivate the employees, the company has decided to announce the different types of bonus depends up on the employee’s Grade. If the employee belong to Grade A bonus=20% basic Grade B bonus=15% basic Grade C bonus=10% basic …

More Similar Questions