Monday, June 18, 2012

Homework 5: Compound Conditions

1. Given the variables  temperature and  humidity , write an expression that evaluates to true if and only if the temperature is greater than  90 and the humidity is less than  10 .

temperature > 90 && humidity < 10

2. Given the integer variables  yearsWithCompany and  department , write an expression that evaluates to true if  yearsWithCompany is less than  5 and  department is not equal to  99 .

yearsWithCompany < 5 && department != 99

3. Given the boolean variable  isFullTimeStudent and the integer variable  age , write an expression that evaluates to true if  age is less than  19 or  isFullTimeStudent is true.

age < 19 || isFullTimeStudent

4. Write an expression that evaluates to true if and only if the value of the boolean variable  isAMember is false. 

isAMember == false

No comments:

Post a Comment