Using if
statements, else if
, and else
statements, make a program which displays a different message depending on the age given.
You may not use && or ||. You must figure out how to make it show only one message using only if
statements, else if
, and else
.
age
message
less than 16
"You can't drive."
16 to 17
"You can drive but not vote."
18 to 24
"You can vote but not rent a car."
25 or older
"You can do pretty much anything."
Note that unlike the original "How Old Are You" assignment, this program must only display exactly one message for a given age and not multiple messages.
Hey, what's your name? (Sorry, I keep forgetting.) Billy_Corgan
Ok, Billy_Corgan, how old are you? 17
You can drive but you can't vote, Billy_Corgan.
©2017 Graham Mitchell