Question: Assume that a boolean variable workedOvertime has been declared , and that another variable , hoursWorked has been declared and initialized . Write a statement

Assume that a boolean variable workedOvertime has been declared, and that another variable, hoursWorked has been declared and initialized. Write a statement that assigns the value true to workedOvertime if hoursWorked is greater than 40 and false otherwise. This needs to be in Java and......here is what I came up with but it is not correct according to "MyProgrammingLab"....can you help???

//workedOvertime = false; //hoursWorked = 40; if(hoursWorked>40) { workedOvertime = true; }else{ if(hourWorked<=40){ workedOvertime=false; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!