The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

The Employee class

It is a common practice that in a business place employees get salary raise based on different criteria such as the position of the employee, job performance, department budget, sales proportion (if the employee is directly involved in sales), etc. In this question, you are going to implement the salary raise scheme for a standard work place.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Write an Employee class that describes an employee with employeeID, firstName, lastName, and salary fields.

Also write a constructor in Employee class that initializes all data fields. Create three different subclasses from class Employee as follows:
1)A Manager subclass that invokes super class’ constructor to initialize its fields and implements the raise method with a 10% increment to the original salary.

2) A SalesAssociate subclass that invokes super class’ constructor to initialize its fields. It should have an extra data field for commission and the raise for a sales associate should be calculated by adding the base salary and the commission amount.

3) A Secretary subclass that invokes super class’ constructor to initialize its fields and implements the raise method with a 5% increment to the original salary

Write a driver class TestEmployee to create an array of three elements: one manager, one sales associate, and one secretary and initialize each with arbitrary initial values that you choose. Calculate the salary raise for each employee and display them in well formatted way to standard output (screen).

Hint: Since we won’t know in advance how method raise() is to be implemented, you need to define raise() method as abstract in the Employee class.