added the calculate function to determine net earnings after deductions