Depending on age (decimal number and gender (m / f), print a personal title:
- “Mr.” – a man (gender “m”) – 16 or more years old.
- “Master” – a boy (gender “m”) under 16 years.
- “Ms.” – a woman (gender “f”) – 16 or more years old.
- “Miss” – a girl (gender “f”) under 16 years.
Watch this video to learn how to solve this problem: https://youtu.be/7WiBbMOAc7Q.
We should notice that the output of the program depends on a few things. First, we have to check what is the entered gender and then check the age. Respectively, we are going to use a few
if-else blocks. These blocks will be nested, meaning from the result of the first, we are going to define which one of the others to execute.
The diagram below illustrates the process in detail:
After reading the input data from the console, the following program logic should be executed:
Test your solution here: https://judge.softuni.org/Contests/Practice/Index/508#0.