Your question is incomplete, here is the complete question with the solution.
Clunker Motors Inc. is recalling all vehicles from model years 1995 - 1998 and 2004 - 2006. A Boolean variable named norecall has been declared. Given an int variable modelYear, write a statement that assigns true to noRecall if the value of modelYear does NOT fall within the two recall ranges and assigns false otherwise.
Answer and Step-by-step explanation:
Given that
boolean norecall;
int modelYear;
We can solve this problem in three ways as given below:
1st Method: Using If statement
if((modelYear > 1994 && modelYear < 1999 )||(modelYear > 2003 && modelYear < 2007 )){
norecall = false; // this will assign false if the value of the modelYear falls within the two recall ranges
}else{
norecall = true; // this will assign true if the value of the modelYear does NOT falls within the two recall ranges
}
2nd Method: Without using If Statement
(!(modelYear >= 1995) && (modelYear <= 1998)) || (!(modelYear >= 2004) && (modelYear <= 2006))
// in this line the ymbol "!" shows that if the range is not within the two recall ranges (1995-1998 & 2004-2006) then it will goes down and will assign true to norecall.
norecall = true;
3rd Method: Using Conditional Statement
((modelYear>=1995 && modelYear <=1998) || (modelYear>=2004 && modelYear<=2006)) ? norecall =true : norecall =false;