More Renters

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   hear noise   go to next page
  • A renter must be 21 years old or older.
  • A renter must have a credit card with credit of $10,000 or more.

Answer:

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

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?