Question
Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 19992002 as well as all vehicles in its Guzzler line from
Clunker Motors Inc. is recalling all vehicles in its Extravagant line from model years 19992002 as well as all vehicles in its Guzzler line from model years 20042007. A boolean variable named recalled has been declared. Given a variable modelYear and a String modelName, write a statement that assigns true to recalled if the values of modelYear and modelName match the recall details and assigns false otherwise.
I have
if((modelYear>=1999 && modelYear<=2002 && modelName=="Extravagant") || (modelYear>=2004 && modelYear<=2007 && modelName=="Guzzler")){ recalled=true;} else recalled = false;
This might be too much if they already state these variables as boolean values. Is this correct according to the directions?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started