16.3k views
5 votes
Clunker Motors Inc. is recalling all vehicles from model years 1995-1998 and 2004-2006.Given a variable modelYear write a statement that assigns True to recalled if the value of modelYear falls within the two recall ranges and assigns False otherwise. Do not use an if statement in this exercise!

User Rvdginste
by
3.8k points

1 Answer

5 votes

Answer:

Following are the statement is given below

recalled = (modelYear >= 2001) && (modelYear <= 2006); // holding the value true if condition is true.

Step-by-step explanation:

Following are the description of above statement

  • Declared a variable recalled of Boolean type .
  • The variable modelYear examine the above condition .
  • The variable recalled holds true if modelYear is greater then or equal 2001 and modelYear is less then or equal to 2006 otherwise if following condition is false then this variable holds False .
User MrKelley
by
3.0k points