Asked by Su

IHow do you refractor this:

public class Employee {
private boolean isPartTime;
private int seniority;
private int monthsDisabled;

public Employee(boolean isPartTime, int seniority, int monthsDisabled) {
this.isPartTime = isPartTime;
this.seniority = seniority;
this.monthsDisabled = monthsDisabled;
}

// TODO: add a function here with the signature: public boolean notEligibleForDisibility()

public double disabilityAmount() {
// TODO: replace these checks with a single function call
if (seniority < 2)
return 0;
if (monthsDisabled > 12)
return 0;
if (isPartTime)
return 0;

// in a real program, there would be other logic for determining
// the amount of disability the employee is eligible for here

Answers

There are no human answers yet.
There are no AI answers yet. The ability to request AI answers is coming soon!