Friday
April 18, 2014

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

algebra :( help me!! - The table below shows the weekly earnings of two groups ...
computer - What does tenure track, part time instructor of computer science does...
anthropology - What ethical challenges come up when studying another culture? ...
Chemistry - 6ClO2 + 3H2O -> 5HClO3 + HCl a) If 71g of ClO2 is mixed with 19g ...
physics - An athlete executing a long jump leaves the ground at a 28.0 angle ...
physics. HELP PLEASE ! - An athlete executing a long jump leaves the ground at a...
College Chemistry - Part a: What mass of solid CuCL2 is required to prepare 450....
English - 1. A person who tells actors in a film or play how to play their parts...
intro to physics - an athlete executing a long jump leaves the ground at a 28 ...
Math - use substitution method for solving x+y=4 (x+2)^2+(y-3)^2=5 I got the ...

Search
Members