Say that you enter 56000 for cash and 0 for credit.
cash >= 25000 true credit >= 25000 false cash >= 25000 || credit >= 25000 true
Here is a part of the program:
// check that at least one qualification is met
if ( cash >= 25000 || credit >= 25000 )
System.out.println("Enough to buy this car!" );
else
System.out.println("Have you considered a Yugo?" );
For you to buy the car, JUST ONE relational expression must be true. With enough cash you can buy the car, no matter what your credit. With enough credit you can buy the car, no matter how much cash. The or-operator checks that at least one of
cash >= 25000 credit >= 25000
is true. The entire question must be true for the true block to execute.
What
if the user has 50000 for cash
and 75000 for credit
?