Question: Description Exercise 4 Learning objective: Make a decision based on the contents of a variable. Class to edit: Exercise 4 Write a program that asks

 Description Exercise 4 Learning objective: Make a decision based on the

Description Exercise 4 Learning objective: Make a decision based on the contents of a variable. Class to edit: Exercise 4 Write a program that asks the user "How old are you?" and stores the answer into an appropriately named and typed variable. If the user is at least 17 years old, print "You are old enough to drive." otherwise print the message "You are not old enough to drive.". The following sample I/O shows what should happen when the user is at least 17 years old: How old are you? " user inputs 17 " You are old enough to drive. Paste as plain text (H++V) The following sample I/O shows what should happen when the user is less than 17 years old: How old are you? "user inputs 16 " You are not old enough to drive. Before submitting to ED, be sure to get all punctuation and spacing correct in the message. In this case, note that the message has just one space between each word, and a single fullstop at the end. Hint: It may be helpful to refer to the example in the Background Material section in EXERCISE DESCRIPTIONS which includes an if/else statement that makes a decision based on the contents of a variable

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!