I am new new new to coding, especially java. This is a homework assignment I am
ID: 3646560 • Letter: I
Question
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, 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.
//Test app
public class WTest
{
public static void main( String args[] )
{
W application = new W();
application.calcW();
}
}
//Main
import java.util.Scanner;
public class W
{
public int calcW()
{
Scanner input = new Scanner( System.in );
String name;
int pay = 0;
int salar = 0;
int hourl = 0;
int weekS = 0;
int weekH = 0;
int hours = 0;
int rate = 0;
int count = 0;
while ( count <= 3 )
{
System.out.print( "Enter name:" );
name = input.next();
System.out.print( "salary or hourly:" );
pay = input.nextInt();
if ( pay == 1 )
{
System.out.print( "Enter amount: " );
salar = input.nextInt();
System.out.print( "Pay %name is $%.2f " );
}
else if ( pay == 2 )
{
System.out.print( "Enter rate: " );
rate = input.nextInt();
System.out.print( "Enter hours: " );
hours = input.nextInt();
System.out.print( "Pay for %name is $%.2f " );
}
if ( weekS = salar / 52 )
{
return weekS;
}
if ( hours > 40 )
{
weekH = ( int ) (( hours - 40 ) * 1.5 * hours + ( 40 * hourl ));
}
else if ( hours <= 40 )
{
weekH = ( hours * 40 );
}
return weekH;
}
}
}
Explanation / Answer
if ( weekS = salar / 52 ) should be if ( weekS == (salar / 52) )
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.