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 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.
M or m outside of age 0 to 130 Invalid age
F or f Thank you for using the system, but we were only looking for men.
Other than M,m, F or f Invalid gender
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 (outside of 0-130), 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, F or f
???????
return 0; //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 -10 Invalid age
M -1 Invalid age
m 0 You need to wait 17 more years.
M 10 You need to wait 7 more years.
M 16 You need to wait 1 more years.

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 Programming Questions!