Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (military2.cpp) Make a program that will display one of the messages below depending on the gender and age the user enters. Gender Age Message

image text in transcribed
1. (military2.cpp) Make a program that will display one of the messages below depending on the gender and age the user enters. Gender Age Message M or m 16 or younger You need to wait X more years. (if 15, 2 more years) M or m Between 17 and 42 The military is hiring more people like you. M or m 43 or older Thank you for using the system. Forf Thank you for using the system, but we were only looking for men. Notice that we are allowing the user to enter *f and 'm' (lowercase) as well as 'F' and 'M' (uppercase) for a gender. Ask for an age only if the gender is male. Use the following structure. if(male) If the user enters an invalid age (negative number), tell him "invalid age" and the program should end (no need to ask for a new age). ??????? else if(female) ??????? else //The user entered a letter other than M, m, Forf ??????? return 0; //end of program Use the following test cases to test your program. Genger Age Message m Invalid age 15 You need to wait 2 more years. 17 The military is hiring more people like you. Thank you for using the system. Thank you for using the system, but we were only looking for men Thank you for using the system, but we were only looking for men. Invalid gender 43

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions