Question: write the program that will get the user's age and print the word working years if age is between 16 and 65 and relax and

write the program that will get the user's age and print the word "working years" if age is between 16 and 65 and "relax and enjoy" if the age is odd and more than 66.

write the program that will get the user's age and print the

+ Tools Add-ons Help All changes saved in Drive mal text - Arial - 11 - BIUA G E- TE-E- 1 . . 2 . 3 . . . 4 . . . . 5 . 6 . The following set of programming problems will be covered in the single hour lecture of the course. HW-2 (Submit the .cpp file) Write a program that will get the user's age and print the words "Working Years" if age is between 16 and 65 and "Relax and Enjoy" if the age is odd and more than 66. Procedure: Start with the usual standard C++ block of statements (Just as in HW 1) Step 1: This program will need user input for the person's age, so you need to declare a variable for that. Since the person's age is a whole number we could use: int age; Step 2: Now collect the input from the user. It's best to display a message associated with each user input. Note: The variable after cin must be typed exactly as it was declared above. cout > age; Step 3: Immediately after the input is collected in the variable age we need to see if it is a valid age, meaning it must be a positive number, otherwise we want tell the user to input a valid number then exit the program. if ( (age = 16) and (age 66) and (age % 2 == 1) ) // age % 2 returns 0 or 1 cout

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!