Monday
March 30, 2015

Homework Help: Computer Science

Posted by Jacob on Sunday, March 25, 2012 at 4:20pm.

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.

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

computer science - I need to see if someone can hepl me with a c# programming ...
Java - You are to create an efficient OO application to be used by the wait ...
computer Programming - A small startup software developer company needs to ...
business - can someone help me with some information on each one of this. ...
business - can someone help me with some information on each one of this. ...
business accounting - can someone help me with some information on each one of ...
computer programming - small startup software developer company needs to create ...
Language arts - Not sure if I'm correct . 2. What do facial features in the poem...
English - Can someone please proofread my essay on snitching and help fix any ...
Business Law - Which of the following is true about determining whether someone ...

Members