Results 1 to 2 of 2
- 07-12-2012, 10:44 PM #1
Member
- Join Date
- Jul 2012
- Posts
- 1
- Rep Power
- 0
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; } } }
- 07-12-2012, 11:17 PM #2
Student
- Join Date
- Jul 2012
- Location
- United States
- Posts
- 328
- Rep Power
- 9
Re: java error incompatible types found int required boolean
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
-
incompatible types error..
By mcajavaprogramer in forum AWT / SwingReplies: 1Last Post: 05-18-2012, 05:47 PM -
incompatible types found object expect integer
By bflhr673 in forum New To JavaReplies: 3Last Post: 07-24-2010, 04:10 PM -
incompatible types error
By magic in forum New To JavaReplies: 3Last Post: 06-02-2010, 05:58 PM -
> Operator cannot be applied error and return incompatible types error
By corney_16 in forum New To JavaReplies: 1Last Post: 03-10-2010, 02:53 PM -
Error: incompatible types, found: int required: boolean
By silvia in forum New To JavaReplies: 6Last Post: 10-08-2008, 09:09 AM
Bookmarks