I'm getting errors when I try to compile this code:

public class EmployeePayRoll
{
   /*** Class Constants ***/

      /*** Defaults ***/

   public static final String DEFAULT_EMPLOYEE_NAME = "Employee";
   public static final double DEFAULT_PAY_RATE = 10.00;
   public static final double DEFAULT_HOURS_WORKED = 40.0;

      /*** Minimums/Maximums ***/

   public static final double MINIMUM_PAY_RATE = 7.25;
   public static final double MAXIMUM_PAY_RATE = 20.00;

   public static final double MINIMUM_HOURS_WORKED = 0.0;
   public static final double MAXIMUM_HOURS_WORKED = 168.0;

   /*** Instance Variables***/

   private String employeeLastName;
   private double hoursWorked;
   private double payRate;

   /*** Constructors ***/

   public EmployeePayRoll( String employeeName, double hours )
   {
      employeeLastName = employeeName;
      hoursWorked = setHoursWorked( hours );
      payRate = DEFAULT_PAY_RATE;
   }

   public EmployeePayRoll( String employeeName, double hours, double hourlyRate )
   {
      employeeLastName = employeeName;
      hoursWorked = setHoursWorked( hours );
      payRate = setPayRate( hourlyRate );
   }

   /*** Mutators ***/

   public void setHoursWorked( double hours )
   {
      if ( verifyHoursWorked ( hours ) )
      	 hoursWorked = hours;

      else
      	 hoursWorked = DEFAULT_HOURS_WORKED;
   }

   public void setPayRate( double hourlyRate )
   {
   	  if ( verifyPayRate ( hourlyRate ) )
   	     payRate = hourlyRate;

   	  else
   	  	 payRate = DEFAULT_PAY_RATE;
   }

   /*** Accessors ***/

   public double getHoursWorked()
   {
   	  return hoursWorked;
   }

   public double getPayRate()
   {
   	  return payRate;
   }

   public double getGrossPay()
   {
   	  return hoursWorked * payRate;
   }

   /*** Helper Methods ***/

   public boolean verifyPayRate( double hourlyRate )
   {
      boolean payRateVerification = false;

	  if ( hourlyRate >= MINIMUM_PAY_RATE )
	  {
	     if ( hourlyRate <= MAXIMUM_PAY_RATE )
		 {
		    payRateVerification = true;
		 }
	  }
	  return payRateVerification;
   }

   public boolean verifyHoursWorked( double hours )
   {
      boolean hoursVerification = false;

	  if ( hours >= MINIMUM_HOURS_WORKED )
	  {
	     if ( hours <= MAXIMUM_HOURS_WORKED )
		 {
		    hoursVerification = true;
		 }
	  }
	  return hoursVerification;
   }
}

I get three "incompatible types" errors... one one line 30, one on line 37, and one on line 38. I read a little about other people's incompatible types errors but I don't understand why I'm getting that error here. Any help would be greatly appreciated.

setHoursWorked is a void return - it doesn't return a value. You can't assign anything to setHoursWorked(), because there's nothing to assign. The best thing to do would be to return the calculated value and leave the assignment, not set "hoursWorked" from within the method.
Same problem for setPayRate.

Ok I see what's wrong now... but to fix it can't I just change my return type to double on both mutators and return hoursWorked and payRate? Maybe that's what you meant but I'm not sure because I don't really understand what you mean by

return the calculated value and leave the assignment, not set "hoursWorked" from within the method.

You can either call the method to set a class field or you can calculate the value and return it to the calling method. You don't want to do both.

My preference would be to calculate the value in your method and return it, and leave the method call as it is:

hoursWorked = setHoursWorked();

You would get the same results, however, by leaving your method as it is and changing the method call to

setHoursWorked();

I prefer the former because it's more flexible. For example later on, I might want to use the results of calling setHoursWorked() without assigning them to hoursWorked - as you've written it, I can't do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.