I want to combine the three if statements and put them into one function isNotEligible() and returns a boolean. The function is on the bottom, can someone help me check and see if I wrote it correctly?
//before:
double disabilityAmt(){
if (senority < 2) return 0;
if (monthsDisabled > 12) return 0;
if (isPartTime) return 0;
}
//after:
double disabilityAmt(){
if (isNotEligible())
return 0;
}
boolean isNotEligible(){
if(senority < 2 || monthsDisabled > 12 || isPartTime)
return 0;
}
//before:
double disabilityAmt(){
if (senority < 2) return 0;
if (monthsDisabled > 12) return 0;
if (isPartTime) return 0;
}
//after:
double disabilityAmt(){
if (isNotEligible())
return 0;
}
boolean isNotEligible(){
if(senority < 2 || monthsDisabled > 12 || isPartTime)
return 0;
}