Question #2(c++) The original condition is true either for a veteran or for anyo
ID: 3881044 • Letter: Q
Question
Question #2(c++)
The original condition is true either for a veteran or for anyone age 800 more whose salary is under 10000. The complement is true for non-veterans who are under 60 years old or earn at least 10000. Section 3.2 Review Questions 1. Using the variables/constants declared here, write C++ expressions for each condition int const double MINPERFORMANCE = 4.0 const double MAX-PRICE= 450.0; double const double LOW-COEFF= 3.5; const double HIGH. COEFF = 5.5; e; - price; double measDepth, degCelsius; const double MIN-DEPTH = 10.0; const double MIN-TEMP = 120.0; bool bool precip; windy;Explanation / Answer
1.
a. heatRemoved/workDone >= MIN_PERFORMANCE && price <= MAX_PRICE
b. (double) heatRemoved/workDone >= LOW_COEFF && (double) heatRemoved/workDone <= HIGH_COEFF
c. measDepth > MIN_DEPTH || degCelcius > MIN_TEMP
d. precip == false && windy == false
2.
a. heatRemoved/workDone >= MIN_PERFORMANCE && price <= MAX_PRICE
480/125 >= 4.0 && 447.00 <= 450.0
3 >= 4.0 && 447.00 <= 450.0
false && 447.00 <= 450.0
false
Evaluation is short circuited. The right side of && is not evaluated .
b. (double) heatRemoved/workDone >= LOW_COEFF && (double) heatRemoved/workDone <= HIGH_COEFF
3.84 >= 3.5 && 3.84 <= 5.5
true && true
true
c. measDepth > MIN_DEPTH || degCelcius > MIN_TEMP
11.2 > 10 || 100.0 > 120
true || 100.0 > 120
true.
Evaluation is short circuited. The right side of || is not evaluated .
d. precip == false && windy == false
false == false && true == false
true && false
false