Question: Make a c + + program that will ask the user to enter the user s gender and age and it will display one of
Make a c
program that will ask the user to enter the users gender and age and it will display one
of the messages below depending on the gender and age.
Gender Age Message
M or m or younger You need to wait X more years. if more years
M or m Between and The military is hiring more people like you.
M or m or older Thank you for using the system.
M or m outside of age to Invalid age
F or f Thank you for using the system, but we were only looking for men.
Other than Mm F or f Invalid gender
Notice that we are allowing the user to enter f and mlowercase as well as F and Muppercase for a
gender.
Ask for an age only if the gender is male.
Use the following structure.
ifmale
If the user enters an invalid age outside of tell him invalid age and the program
should end no need to ask for a new age
else iffemale
else The user entered a letter other than M m F or f
return ; end of program
Use the following test cases to test your program. Remember it is necessary to test your program using all
of the following test cases called the edge case testing technique
Gender Age Message
X Invalid gender
F Thank you for using the system, but we were only looking for men.
f Thank you for using the system, but we were only looking for men.
m Invalid age
M Invalid age
m You need to wait more years.
M You need to wait more years.
M You need to wait more years.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
