Class Employee
Class Employee
java.lang.Object
|
+----Person
|
+----Employee
- public class Employee
- extends Person
The Employee class is used to represent
employees of our company. It augments the Person
class with information about an employee's salary and
job title.
This class was written by:
- Version:
- 1.0.0
- Author:
- Mike Cohn
- See Also:
- Contractor
-
Employee(float, String, String)
- This constructor is used to create a new employee and
assign him an initial salary.
-
AssignJob(String)
- This method assigns the employee to the
specified job.
-
ChangeSalary(float)
- This function changes the employees salary.
-
GetJobTitle()
- This function returns the job title of the employee.
-
GetMaxWorkingAge()
- This method return the highest age at which
an employee can remain at work.
Employee
public Employee(float sal,
String fName,
String lName)
- This constructor is used to create a new employee and
assign him an initial salary. It does not verify that
salary is less than the company's maximum salary.
You could use this method as follows:
Employee Emp = new Employee(35000f,"Mike","Cohn");
- Parameters:
- sal - The starting salary of the new employee.
- fName - The employee's first name.
- lName - The employee's last name.
AssignJob
public void AssignJob(String newJob)
- This method assigns the employee to the
specified job. This method does not verify the
job title against the list of approved
job titles created by Human Resources.
Likely job titles you may want to pass include:
- Programmer
- Analyst
- QA
- Tech Writer
- Project Manager
- Database Administrator
- Database Engineer
Reminder: All positions must be approved by the
Manager of Human Resources according to
the company's Employee Hiring Guidelines.
- Parameters:
- newJob - This is the new job title.
- See Also:
- GetJobTitle
GetJobTitle
public String GetJobTitle()
- This function returns the job title of the employee.
- Returns:
- A string representing the job title (for
example, "programmer").
- See Also:
- AssignJob
GetMaxWorkingAge
public static int GetMaxWorkingAge()
- This method return the highest age at which
an employee can remain at work.
After this age, an employee must retire and
move to Florida.
- Returns:
- The last allowable working year before
mandatory retirement.
ChangeSalary
public boolean ChangeSalary(float newSalary)
- This function changes the employees salary.
A salary change can occur only after the two following
tests have been applied:
- The new salary is higher than the current salary.
- The new salary is less than the maximum salary.
- Parameters:
- newSalary - The proposed new salary.
- Returns:
- true if the salary change is approved,
false otherwise.