Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define an Employee class. An Employee has a name, an ID number, an age, a salary, a title, and a department name. The methods of

Define an Employee class. An Employee has a name, an ID number, an age, a salary, a title, and a department name.

The methods of Employee should:

a. Print an employee record that includes all of the above information

b. Change a salary, changeSalary(), and

c. return the salary, getSalary().

The method changeSalary() accepts a parameter, increase, of type int or double. If increase is an int, then the salary should be increased by that amount. If increase is double, then the new salary should be (increase + 1) times the salary. For example, if the increase is 0.10, the salary is multiplied by 1.10, yielding an increase of 10%. The value of the (double) increase should be between 0.0 and 1.0. Define a class Manager that Extends Employee.

A manager is an employee who supervises other employees. A Manager object should include all data of the Employee object plus the list of the employee ID numbers of those employees under his/her supervision as well as all the other relevant data.

Define a class Executive that extends Manager. An Executive is a Manager who receives a bonus a the end of each year equal to percentage of his/her regular salary. Each Executive has his/her own bonus rate. You will need to redefine getSalary() to include the bonus. You will also need to add a setter (mutator) method, setBonus(), to set the percentage of the executives bonus. The default bonus rate should be 10%.

Implement a test class that demonstrates the facilities of the Employee, Manager, and Executive classes. Your test class should accept employee information for an arbitrary number of employees.

Your program should ask whether or not the employee is a manager or an executive, and prompt for all relevant information. After all data are entered, print an error message if there are any inconsistencies. In particular, a manager cannot manage a nonexistent employee. Also, every employee who is not an executive is supervised by some manager or executive. Your program should provide the user with the following options:

Change the salary of an employee

Adjust the bonus of an executive

Add or delete an employee from a managers list of employees Print an employees data If any change causes an inconsistency in the data, your program should print an error and not allow the change.

Your program should access an employee via the employee ID number. Use a binary search to find an employees record.

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

Step: 3

blur-text-image

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago