Menu
Question Index
...

Write a program to print the classification of the student like 'Dull Boy', 'Intelligent Girl', 'Average Boy' depending upon the marks and gender using only ternary operator. Do not use if conditions.
NOTE: If the marks greater than or equal to 75, then the student is 'Intelligent', if marks greater than or equal to 35, the student is 'Average' otherwise the student is 'Dull'.
If the sex is 'M' then student is a 'Boy' and if it 'F' then student is a 'Girl'.

Use System.out.println or System.out.print for printing.

Input (Integer, Character) Printed Output
35, 'F' Average Boy
20, 'F' Dull Girl
90, 'F' Intelligent Girl
40, 'M' Average Boy
18, 'M' Dull Boy
75, 'M' Intelligent Boy



class ClassifyStudent
{
    public static void main(String s[])
    {
        printStudentClassification(30, 'M');

    }


    public static void printStudentClassification(int marks, char gender)
    {
    }

}

Doubts

Problems

Topic: Ternary Operator In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App