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.
Code:
//Test app
public class ETest{
public static void main( String args[] ){
E application = new E();
application.calcE();
}
}
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;
}
}
}
Re: java error incompatible types found int required boolean
Hint: Something here doesn't look right :o:
Quote:
Originally Posted by
Code Oranj
Code:
if ( weekS = salaried / 52 )
{
return weekS;
}