Classify Person On Age And Gender Using Ternary - Java Quiz Question


Write a program using ternary operator to print whether the person is Man, Boy, Woman or Girl depending upon the gender and age. Note if the age is greater than 25 boy will become man and if the age is greater than 20 girl will become woman.

Input (Integer, Character) Output (String)
40, 'M' Man
15, 'M' Boy
25, 'M' Boy
35, 'F' Woman
12, 'F' Girl
20, 'F' Girl



class ClassifyPersonUsingTernaryOperator
{
    public static void main(String s[])
    {
        System.out.println("A person with age 25 and female will be : " + classifyPerson(25, 'F'));

    }


    public static String classifyPerson(int age, char gender)
    {
        String result = null;
        return result;
    }

}