What is wrong with the following statement? How could you correct it?if(payRate < 5.85 && payRate > 60)System.out.println("Error in pay rate");

What will be an ideal response?


As a single variable, no payRate value can ever be both below 5.85 and over 60 at the same time. Therefore, the output statement can never execute, no matter what value the payRate has. In this case, you must write the following code to print the error message under the correct circumstances:
if(payRate < 5.85 || payRate > 60)
   System.out.println("Error in pay rate");

Computer Science & Information Technology

You might also like to view...

In a database, a query is where a set of related data is stored

Indicate whether the statement is true or false

Computer Science & Information Technology

In fold boundary the key value is divided into parts whose size matches the size of the required address.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Broadband connections provide greater ____, the speed at which information travels over the Internet.

A. DSL B. modulation C. multiplexing D. bandwidth

Computer Science & Information Technology

Side headings are keyed at the ____.

A. center of the page B. left margin C. right edge of the page D. end of the report

Computer Science & Information Technology