title: Error: incompatible types?
body: <p>Can someone tell me why I'm getting an error called incompatible types? This is the full error: <code>PayrollTest.java:26: error: incompatible types: possible lossy conversion from double to int.</code></p>
  
  <pre><code>01: import java.util.Scanner;
  02:
  03: public class PayrollTest{
  04:
  05:     public static void assignEmployeeHoursAndPayrates( Payroll payrollObject ) {
  06:         Scanner keyboard = new Scanner( System.in );
  07:         int employeeHours;
  08:         double employeePayRate;
  09:
  10:         for( int employeeIndex = 0; employeeIndex &lt; payrollObject.getAllEmployeeIds().length; employeeIndex++ ) {
  11:             System.out.println( "Please enter the hours for employee " + payrollObject.getAllEmployeeIds()[ employeeIndex ] );
  12:             employeeHours = keyboard.nextInt();
  13:             while( employeeHours &lt; 0 ) {
  14:                 System.out.println( "Please enter POSITIVE hours for employee " +
  15:                                    payrollObject.getAllEmployeeIds()[ employeeIndex ] );
  16:                 employeeHours = keyboard.nextInt();
  17:             }
  18:             payrollObject.setEmployeeHours( employeeHours, employeeIndex );
  19:             System.out.println( "What's the payrate for employee " + payrollObject.getAllEmployeeIds()[ employeeIndex ] );
  20:             employeePayRate = keyboard.nextDouble();
  21:             while( employeePayRate &lt; 6.00 ) {
  22:                 System.out.println( "What's the payrate for employee " +
  23:                                    payrollObject.getAllEmployeeIds()[ employeeIndex ] + "( $6 or ABOVE please)" );
  24:                 employeePayRate = keyboard.nextDouble();
  25:             }
  26:             payrollObject.setEmployeePayRate( employeePayRate, employeeIndex );
  27:         }
  28:     }
  29:
  30:     public static void displayEmployeeWages( Payroll payrollObject) {
  31:         for( int employeeIndex = 0; employeeIndex &lt; payrollObject.getAllEmployeeIds().length; employeeIndex++ ) {
  32:             System.out.println( "The employee with id number " + payrollObject.getAllEmployeeIds()[ employeeIndex ] +
  33:                                " worked for " + payrollObject.getAllEmployeeHours()[ employeeIndex ] +
  34:                                " hours and earned " +
  35:                                String.format( "$%,.2f" , payrollObject.getAllEmployeeWages()[ employeeIndex ] ) );
  36:         }
  37:     }
  38:
  39:     public static void main( String [ ] args ) {
  40:         Payroll employeeInfo = new Payroll();
  41:         assignEmployeeHoursAndPayrates( employeeInfo );
  42:         employeeInfo.calculateWages();
  43:         displayEmployeeWages( employeeInfo );
  44:
  45:         int singleEmployeeId = 7895122;
  46:
  47:         if( employeeInfo.getEmployeeWagesById( singleEmployeeId ) != -1 ) {
  48:             System.out.println( "The single employee with id " + singleEmployeeId + " earned " +
  49:                                String.format( "$%,.2f", employeeInfo.getEmployeeWagesById( singleEmployeeId ) ) );
  50:         } else{
  51:             System.out.println( "The single employee with id " + singleEmployeeId + " wasn't found" );
  52:         }
  53:     }
  54: }
  </code></pre>