Clunker Motors Inc. is recalling all vehicles from model years 2001-2006. Given a variable model Year write a statement that assigns True to no recall if the value of model Year is NOT within the recall range and assigns False otherwise. Do not use an if statement in this exercise!

Respuesta :

Answer:

bool recall = (model >= 2001) && (model <= 2006);

Explanation:

The above statement assigns true or false to variable recall depending on the results of the conditional statements.

The recall variable is a bool variable, it takes either true or false values only.

(model >= 2001) && (model <= 2006)

The above statement checks if model is between 2001 and 2006 (both years inclusive) without having an if statement.

if true, recall = true, else recall = false.

ACCESS MORE
EDU ACCESS
Universidad de Mexico