Clunker Motors Inc is recalling all vehicles in its Extravagant line from model years 1999 – 2002 as well as all vehicles in its Guzzler line from model years 2004-2007. Given an int varialbe modelYear and a string modelName write a statement that prints the message “RECALL” to standard output if the values of modelYear and modelName match the recall details.

Clunker Motors Inc is recalling all vehicles in its Extravagant line from model years 1999 – 2002 as well as all vehicles in its Guzzler line from model years 2004-2007.  Given an int varialbe modelYear and a string modelName write a statement that prints the message “RECALL” to standard output if the values of modelYear and modelName match the recall details.

LANGUAGE: Visual Basic

CHALLENGE:

Clunker Motors Inc is recalling all vehicles in its Extravagant line from model years 1999 – 2002 as well as all vehicles in its Guzzler line from model years 2004-2007. Given an int varialbe modelYear and a string modelName write a statement that prints the message “RECALL” to standard output if the values of modelYear and modelName match the recall details.

SOLUTION:

If (modelYear >= 1999 And modelYear <= 2002 And modelName = "Extravagant") Or (modelYear >= 2004 And modelYear <= 2007 And modelName = "Guzzler")  Then
    MessageBox.Show("RECALL")
End If


Add comment