4.8: Logical Operators

Ace your homework & exams now with Quizwiz!

Write a statement that toggles the value of the bool variable onOffSwitch. That is, if onOffSwitch is false , its value is changed to true ; if onOffSwitch is true , its value is changed to false .

if(onOffSwitch){ onOffSwitch = false; }else{ onOffSwitch = true; }

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

isAMember == false

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 .

isFullTimeStudent || age < 19

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

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


Related study sets

Ch 4: Climate - Section 1: Succession

View Set

Chapter 40: Fluid, Electrolyte, and Acid-Base Balance

View Set

RH OpenShift I: Containers & Kubernetes 4.5

View Set

The Secret Life of Bees Chapters 6-7 Review

View Set

Saunders ch 5: Cultural Awareness and Health Practices

View Set