Tuesday
September 23, 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

computer science - I need to see if someone can hepl me with a c# programming ...
Language arts - Not sure if I'm correct . 2. What do facial features in the poem...
Math - A fast food shop plans to employ 8 full-time staff and some part-time ...
Powerpoint #3 - okay, I need to do a powerpoint for this career "computer ...
math - a store has a total of 108 full-time staff and part time staff. There ...
algebra :( help me!! - The table below shows the weekly earnings of two groups ...
probability - out of 250 students interviewed at a community college, 90 were ...
Chemistry - I need help predicting the products and naming them using classes ...
Math !!!!!!!! - Ok i have a Summer Math Assignment & i really need help on this...
Computer Science - Write a Class to represent one of the following items. Note ...

Search
Members