Answer:

if (  !(cost < 50)  )
  System.out.println("Reject these shoes");
else
  System.out.println("Acceptable shoes");

Example

It is important to put parentheses around the entire expression so the NOT is applied correctly. Say that you are considering a pair of $35 shoes. Evaluation proceeds like this:

! ( cost < 50 )

! (  35  < 50 )
    -----+----    
         |                  
! (      T    )
------+--------
      |
      F

The entire condition evaluates to false and so the false branch of the if statement is selected. The program prints out "Acceptable shoes".

QUESTION 24:

Is the following program fragment correct?

if (  !cost < 50  )
  System.out.println("Reject these shoes");
else
  System.out.println("Acceptable shoes");