Monday, June 18, 2012

Homework 6: Operations-2

1. Write an expression that evaluates to true if and only if the value of the integer variable  x is equal to zero.

x==0

2. Write an expression that evaluates to true if and only if the variables  profits and  losses are exactly equal.


profits == losses

3. Given the  char variable  c , write an expression that is true if and only if the value of  c is not the space character. 

c != '`'

4. Write an expression that evaluates to true if the value of  index is greater than the value of  lastIndex . 

index > lastIndex

5. Working overtime is defined as having worked more than 40 hours during the week. Given the variable  hoursWorked , write an expression that evaluates to true if the employee worked overtime. 

hoursWorked > 40

6. Write an expression that evaluates to true if the value  x is greater than or equal to  y . 

x >= y

7. Given the variables  numberOfMen and  numberOfWomen , write an expression that evaluates to true if the number of men is greater than or equal to the number of women. 

numberOfMen >= numberOfWomen

8. Given a  double variable called  average , write an expression that is true if and only if the variable's value is less than 60.0. 

average < 60.0

9. Given an  int variable  grossPay , write an expression that evaluates to true if and only if the value of  grossPay is less than 10,000. 

grossPay < 10000


No comments:

Post a Comment