Question: USING JAVA: -Get the desired output from EmployeeChecker.java: -DO NOT MODIFY EMPLOYEECHECKER.JAVA *-Modify the other codes as needed: You must only use the java classes
USING JAVA:
-Get the desired output from EmployeeChecker.java:
-DO NOT MODIFY EMPLOYEECHECKER.JAVA
*-Modify the other codes as needed: You must only use the java classes provided.*

-All the code will interact and be in packages.

THE CODES WILL BE BELOW:
Employee.java:
package EmployeeBlueprints; import EmployeeBlueprints.EmployeeType; import EmployeeBlueprints.Printable; public abstract class Employee implements Printable { private String firstName; private String lastName; private int employeeNum; private String department; private String jobTitle; private EmployeeType employeeType; public Employee(String fn, String ln, int en, String dept, String job) { this.firstName = fn; this.lastName = ln; this.employeeNum = en; this.department = dept; this.jobTitle = job; } public Employee(String firstName, String lastName, int employeeNum, EmployeeType et) { this.firstName = firstName; this.lastName = lastName; this.employeeNum = employeeNum; this.department = ""; this.jobTitle = ""; this.employeeType = et; } public Employee(Employee e) { this.firstName = e.getFirstName(); this.lastName = e.getLastName(); this.employeeNum = e.getEmployeeNum(); this.department = e.getDepartment(); this.jobTitle = e.getJobTitle(); this.employeeType = e.getEmployeeType(); } public Employee() { this.firstName = ""; this.lastName = ""; this.employeeNum = 0; this.department = ""; this.jobTitle = ""; this.employeeType = EmployeeType.HOURLY; } public String getFirstName() { return firstName; } public void setFirstName(String fn) { this.firstName = fn; } public String getLastName() { return lastName; } public void setLastName(String ln) { this.lastName = ln; } public int getEmployeeNum() { return employeeNum; } public void setEmployeeNum(int en) { this.employeeNum = en; } public String getDepartment() { return department; } public void setDepartment(String dept) { this.department = dept; } public String getJobTitle() { return jobTitle; } public void setJobTitle(String job) { this.jobTitle = job; } public EmployeeType getEmployeeType() { return employeeType; } public void setEmployeeType(EmployeeType et) { this.employeeType = et; } public String toString() { return "Name: " + firstName + " " + lastName + " " + "Employee Number: " + employeeNum + " " + "Department: " + department + " " + "Job Title: " + jobTitle + " " + "Type: " + employeeType.toString() + " "; } public abstract void resetWeek(); public abstract double calculateWeeklyPay(); public abstract void annualRaise(); public abstract double holidayBonus(); public abstract void setPay(double pay); public void print() { System.out.println(this.toString()); } }
Printable.java:
package EmployeeBlueprints; import java.text.NumberFormat; public interface Printable { NumberFormat currency = NumberFormat.getCurrencyInstance(); NumberFormat percent = NumberFormat.getPercentInstance(); default void print() { System.out.println(toString()); } }
EmployeeType.java:
package EmployeeBlueprints; public enum EmployeeType { HOURLY, SALARY, COMMISSION; @Override public String toString() { String type = switch (this.ordinal()) { case 0 -> "Hourly"; case 1 -> "Salary"; case 2 -> "Commission"; default -> ""; }; return type; } }
HourlyEmployee.java:
package EmployeeObjects; import EmployeeBlueprints.EmployeeType; import EmployeeBlueprints.Printable; import EmployeeBlueprints.Employee; public class HourlyEmployee extends Employee { private double wage; private double hoursWorked; public HourlyEmployee(String fn, String ln, int en, String dept, String job, double wage) { super(fn, ln, en, dept, job); this.wage = wage; hoursWorked = 0.0; } public HourlyEmployee(String fn, String ln, double wage, EmployeeType et) { this(fn, ln, 0, "", "", wage); } @Override public String toString() { return super.toString() + " Wage: " + Printable.currency.format(wage) + " Hours Worked: " + hoursWorked; } public void increaseHours() { increaseHours(1.0); } public void increaseHours(double h) { if (h >= 0.0) { hoursWorked += h; } } public void resetWeek() { hoursWorked = 0.0; } public void annualRaise() { wage *= 1.05; } public double holidayBonus() { return calculateWeeklyPay() * 40; } public double calculateWeeklyPay() { double pay = 0.0; if (hoursWorked > 40) { pay = 40 * wage + 1.5 * wage * (hoursWorked - 40); } else { pay = hoursWorked * wage; } return pay; } public void setPay(double pay) { this.wage = pay; } }
SalaryEmployee.java:
package EmployeeObjects; import EmployeeBlueprints.EmployeeType; import EmployeeBlueprints.Printable; import EmployeeBlueprints.Employee; public class SalaryEmployee extends Employee { private double salary; public SalaryEmployee(String fn, String ln, int en, String dept, String job, double salary) { super(fn, ln, en, dept, job); this.salary = salary; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public double calculateWeeklyPay() { return salary / 52; } public void resetWeek() { } public void annualRaise() { salary *= 1.04; } public double holidayBonus() { return salary / 2; } public void setPay(double pay) { salary = pay; } @Override public String toString() { return super.toString() + " Salary: " + Printable.currency.format(salary); } }
CommissionEmployee.java:
package EmployeeObjects; import EmployeeBlueprints.EmployeeType; import EmployeeBlueprints.Printable; import EmployeeBlueprints.Employee; import java.text.NumberFormat; public class CommissionEmployee extends Employee { private double sales; private double rate; // Constructor method to initialize all the variables of CommissionEmployee public CommissionEmployee(String fn, String ln, int en, String dept, String job, double rate) { super(fn, ln, en, dept, job); this.rate = rate; this.sales = 0.0; } // Returns the weekly pay for a CommissionEmployee public double calculateWeeklyPay() { return rate * sales; } // Increases the rate by .002 public void annualRaise() { rate += .002; } // Returns 0 as holiday bonus for CommissionEmployee public double holidayBonus() { return 0.0; } // Resets sales to 0.0 public void resetWeek() { sales = 0.0; } // Increases sales by 100.0 public void increaseSales() { sales += 100.0; } // Increases sales by the value sent in the argument public void increaseSales(double s) { if (s > 0.0) { sales += s; } } // Set rate to the value sent in the argument public void setPay(double pay) { rate = pay; } // Overrides the toString method of Employee class public String toString() { String str = super.toString(); NumberFormat percent = NumberFormat.getPercentInstance(); NumberFormat currency = NumberFormat.getCurrencyInstance(); percent.setMaximumFractionDigits(3); str += "Rate: " + percent.format(rate) + " "; str += "Sales: " + currency.format(sales) + " "; return str; } } EmergencyContact.java:
package EmployeeBlueprints; public class EmergencyContact { private String name; private String relationship; private String phone; public EmergencyContact(String nm, String rel, String tele) { name = nm; relationship = rel; phone = tele; } public String getName() { return name; } public void setName(String nm) { name = nm; } public String getRelationship() { return relationship; } public void setRelationship(String rel) { relationship = rel; } public String getPhone() { return phone; } public void setPhone(String tele) { phone = tele; } public void printContact() { System.out.println("Name: " + name); System.out.println("Relationship: " + relationship); System.out.println("Phone Number: " + phone); } }
******DO NOT MODIFY ****EmployeeChecker.java:*******
package App; import EmployeeObjects.SalaryEmployee; import EmployeeObjects.HourlyEmployee; import EmployeeObjects.CommissionEmployee; import EmployeeBlueprints.Employee; import static EmployeeBlueprints.EmployeeType.*; public class EmployeeChecker { public static void main(String[] args) { Employee[] employees = new Employee[5]; employees[0] = new SalaryEmployee("Steve", "Rodgers", 3781, "Sales", "Manager", 64325); employees[1] = new CommissionEmployee("Clint", "Barton", 6847, "Sales", "Customer Representative", .0265); employees[2] = new HourlyEmployee("Tony", "Stark", 5749, "Service", "Lead Service Manager", 32.85); employees[3] = new HourlyEmployee("Thor", "Odinson", 1281, "Operations", "Product Stocker", 12.76); employees[4] = new SalaryEmployee("Bruce", "Banner", 7589, "Service", "Manager", 43876); // use employee type to only print salary employees System.out.println("**** Salary Employees ****"); for (Employee e : employees) { if (e.getEmployeeType() == SALARY) { System.out.println(e + " "); } } // use employee type to only print hourly employees System.out.println("**** Hourly Employees ****"); for (Employee e : employees) { if (e.getEmployeeType() == HOURLY) { System.out.println(e + " "); } } // use employee type to only print the commission employees // also check the print() method System.out.println("**** Commission Employees ****"); for (Employee e : employees) { if (e.getEmployeeType() == COMMISSION) { e.print(); } } } }Running the Employee Checker should produce these EXACT result: *** Salary Employees **** Name: Steve Rodgers ID: 3781 Department: Sales Title: Manager Type: Salary Salary: $64,325.00 Name: Bruce Banner ID: 7589 Department: Service Title: Manager Type: Salary Salary: $43,876.00 **** Hourly Employees **** Name: Tony Stark ID: 5749 Department: Service Title: Lead Service Manager Type: Hourly Wage: $32.85 Hours Worked: 0.0 Name: Thor Odinson ID: 1281 Department: Operations Title: Product Stocker Type: Hourly Wage: $12.76 Hours Worked: 0.0 **** Commission Employees **** Name: Clint Barton ID: 6847 Department: Sales Title: Customer Representative Type: Commission Rate: 2.65% Sales: $0.00 Your project should look like this
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
