Results 1 to 2 of 2
  1. #1
    Code Oranj is offline Member
    Join Date
    Jul 2012
    Posts
    1
    Rep Power
    0

    Default java error incompatible types found int required boolean

    Hello,

    I am new new new to coding, especially java. This is a homework assignment I am working on, and I need help getting it to compile. Every time I fix one problem, another arises. Right now, I seem to have it widdled down to one error: It says boolean required, int found. Can someone please explain to me how to repair this. Also, if you see different mistakes I haven't caught yet, I would love to know what they are. I do have a certain set if guidlelines to follow (only 3 employees, name, hourly or salary (h or s), broken down by week pay, & over time) namely that I am to keep it as simple as possible. We will be working on more complicated coding next lesson.

    I have looked around the forums and found similar problems, but none that seemed workable for me, so I am creating a new thread. Thank you so much for any time and help you can offer.


    Java Code:
    //Test app
    public class ETest{
    	public static void main( String args[] ){
    		E application = new E();
    		application.calcE();	
    }			
    }
    Java Code:
    //Main
    import java.util.Scanner;
    public class E{
        public int calcE(){ 	
    	Scanner s = new Scanner( System.in ); 		
    	String n;    					
    	int pay = 0;    				
    	int salaried = 0;    			
    	int hourly = 0;				
    	int weekS = 0;    				
    	int weekH = 0;    				
    	int hours = 0;    			
    	int rate = 0;	    				
    	int count = 0;					
    
    	while ( count <= 3 ){
    	System.out.print( "name" );        
    	name = s.next();        			
    	System.out.print( "salaried [s] or hourly [h]" );      
    	pay = s.nextInt();			
    
            if ( pay == s ){    	       
    	System.out.print( "amount" );            
    	salaried = s.nextInt();
    	System.out.print( "Pay %n is $%.2f\n" );    
    	} 							
    	else if ( pay == h ){            
    	System.out.print( "rate" );	
    	rate = s.nextInt();            		
    	System.out.print( "hours" );	
    	hours = s.nextInt();            		
    	System.out.print( "Pay for %n is $%.2f\n" );
            }    						
    
    	if ( weekS = salaried / 52 ){
    		return weekS;   			
    		} 	       
    	if ( hours > 40 ){                    		
    		weekH = ( hours - 40 ) *  1.5 * hours + ( 40 * hourly );
            	} 
    	else if ( hours <= 40 ){       
    		weekH = ( hours * 40 );  	   
    		}        
    		return weekH;				
    }						
    }								
    }

  2. #2
    awinston is offline Student
    Join Date
    Jul 2012
    Location
    United States
    Posts
    328
    Rep Power
    3

    Default Re: java error incompatible types found int required boolean

    Hint: Something here doesn't look right

    Quote Originally Posted by Code Oranj View Post
    Java Code:
    if ( weekS = salaried / 52 )
    {
    	return weekS;   			
    }
    Last edited by awinston; 07-12-2012 at 11:21 PM. Reason: Format
    "Success is not final, failure is not fatal: it is the courage to continue that counts." - Winston Churchill

Similar Threads

  1. incompatible types error..
    By mcajavaprogramer in forum AWT / Swing
    Replies: 1
    Last Post: 05-18-2012, 05:47 PM
  2. incompatible types found object expect integer
    By bflhr673 in forum New To Java
    Replies: 3
    Last Post: 07-24-2010, 04:10 PM
  3. incompatible types error
    By magic in forum New To Java
    Replies: 3
    Last Post: 06-02-2010, 05:58 PM
  4. Replies: 1
    Last Post: 03-10-2010, 02:53 PM
  5. Replies: 6
    Last Post: 10-08-2008, 09:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •