Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

It is a common practice that in a business place employees get salary raise base

ID: 3651337 • Letter: I

Question

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: - A Manager subclass that invokes super class

Explanation / Answer

public abstract class Employee { int employeeID; String firstName; String lastName; double salary; public Employee(int id, String f, String l, double s) { employeeID = id; firstName = f; lastName = l; salary = s; } public abstract void raise(); {} } public class Manager extends Employee { public Manager(int employeeID, String firstName, String lastName, double salary) { super(employeeID, firstName, lastName, salary); } public void raise() { salary += salary * 0.1; } public String toString() { return "Employee ID: " + employeeID + ", Name: " + firstName + " " + lastName + ", Salary: $" + salary; } } public class SalesAssociate extends Employee { public double comm; public SalesAssociate(int employeeID, String firstName, String lastName, double salary, double com) { super(employeeID, firstName, lastName, salary); this.comm = com; } public void raise() { salary += comm; } public String toString() { return "Employee ID: " + employeeID + ", Name: " + firstName + " " + lastName + ", Salary: $" + salary; } } public class Secretary extends Employee { public Secretary(int employeeID, String firstName, String lastName, double salary) { super(employeeID, firstName, lastName, salary); } public void raise() { salary += salary * 0.05; } public String toString() { return "Employee ID: " + employeeID + ", Name: " + firstName + " " + lastName + ", Salary: $" + salary; } } public class TestEmployee { public static void main(String[] args) { Employee[] arr = new Employee[3]; arr[0] = new Manager(1001, "John", "Smith", 50000.0); arr[1] = new SalesAssociate(1002, "Jane", "Doe", 40000.0, 700.0); arr[2] = new Secretary(1003, "Maggie", "Cooper", 30000.0); for(int i=0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote