go to previous page   go to home page   go to next page hear noise highlighting

Answer:

    if ( age>=21 && credit>=10000 )

The relational operators are both >= because the renter may be exactly 21 and may have exactly $10,000 credit. Using > where greater-or-equal is required is a common mistake.

The customer must get true for both the age test and the credit test. If both tests are passed, the && combines the two true's into true.


More Renters

A 24 year old customer with $0 credit could not rent a car. The boolean expression looks like this:

age >= 21 && credit >= 10000
---------    ---------------
  true            false
    ----------------
          false

A 19 year old customer with $500000 credit could not rent a car. The boolean expression looks like this:

age >= 21 && credit >= 10000
---------    ---------------
  false            true
    ----------------
          false

QUESTION 8:

Could a 30 year old with $10000 credit rent a car?


go to previous page   go to home page   go to next page