Age Messages 3

Using if statements with compound conditions (like &&), make a program that displays a single message depending on the age given.

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."

This output of this assignment is identical to the "How Old Are You, Specifically" assignment. However, this time you must accomplish it using if statements with compound conditions and you must not use else if or else.

Your name: Dukes
Your age: 19

You can vote but you can't rent a car, Dukes.




©2017 Graham Mitchell