Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How to design the hierarchy? My thought is Salaried Employee extends Salaried Supervisor, and Salaried Supervisor extends Employee Database.(Hourly Employee extends Hourly Supervisor, and Hourly

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

How to design the hierarchy? My thought is Salaried Employee extends Salaried Supervisor, and Salaried Supervisor extends Employee Database.(Hourly Employee extends Hourly Supervisor, and Hourly Supervisor extends Employee Database) Is this correct or not?

IV. Java Programming (60% of your grade) For this project you will implement a simple employee database. Note that we did a small employee hierarchy as a lecture example. You can use that as a guide, but the specifications below are different and so you should not use exactly the lecture example Design Rules: Your project must contain the following seven types and each type must contain the listed methods. The project may use any combination of classes, abstract classes, or interfaces that you feel is appropriate. The project may add additional types to the ones listed. The classes/types may contain additional methods to the ones listed if you feel they are needed. You may use any combination of inheritance, method overriding, and method overloading to achieve the needed behavior. Part of the coding grade will be the quality of the hierarchy you create Hint (repeated from above): Spend a lot of time designing your hierarchy before you code. A well designed hierarchy will reduce the amount of code you have to write The seven types your project must contain represent different kinds of employees and supervisors as well as the database of employees and supervisors. The types are 1. SalariedEmployee: a salaried employee is an employee that earns a fixed salary. The necessary methods for SalariedEmployee are 1. constructor: (String firstName, String lastName, String number, double salary) 2. string getFirstName(): returns the first name of the employee 3. string getlastName (): returns the last name of the employee 4. void setName (String firstName, String lastName): sets the first and last names for the employee 5. String getNumber(: returns the employee number of the employee 6. double getsalary(): returns the salary of the employee 7. void setsalary (double salary): sets the salary of the employee 8. double getBonus (): returns the bonus of the employee 9. void setBonus (double bonus): sets the bonus of the employee 10. double getAmountEarned (): returns the total amount earned by the employee (equals the salary plus the bonus) 11. void adjustPay (double percentage): increases (or decreases) the salary of the employee by the given percentage (for example, an employee earning S50,000 with a 10% adjustment would now have a salary of $55,000) 12. string toString(: Overrides the method of object. Returns a String representation which is in the format "number: last name, first name, Salaried Employee" 13. boolean equals: Overrides the method of object. Two employees are equal if both names and the number are equal. 14. int compareToByName: compares the name of this employee to the name of the parameter. Returns a negative value if this employee's name precedes the parameter's in alphabetical order (last name, then first name), returns 0 if this employee has the same name as the parameter, and returns a positive value if this employee's name comes after the paramter's name in alphabetical ordeir 15. int compareToByEarnings: compares the total amount earned by this employee to that of the parameter. Returns a negative value if this employee earns less, returns 0 if this employees earn the same amount as the parameter, and returns a positive value if this employee earns more than the parameter. 16. void setSupervisor: sets the supervisor for the employee. The supervisor must be one of the three supervisor types listed below 17. getsupervisor(): returns the supervisor for the employee

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions