KnowledgeBoat Logo

Computer Applications

Admission in a professional course is subject to the following criteria:

  1. Marks in Physics >= 70
  2. Marks in Chemistry >= 60
  3. Marks in Mathematics >= 70
  4. Total marks in all subjects >= 225
    Or
    Total marks in Physics and Mathematics >= 150

Write a program in Java to accept marks in these 3 subjects (Physics, Chemistry, and Mathematics) and display if a candidate is eligible.

Java

Java Conditional Stmts

18 Likes

Answer

import java.util.Scanner;

public class KboatAdmission
{
    public static void main(String args[]) {
        Scanner in = new Scanner(System.in);
        System.out.print("Enter marks in Physics: ");
        int p = in.nextInt();
        System.out.print("Enter marks in Chemistry: ");
        int c = in.nextInt();
        System.out.print("Enter marks in Mathematics: ");
        int m = in.nextInt();
        int t = p + c + m;
        int pm = p + m;
        
        if (p >= 70 && c >= 60 && m >= 70 
             && (t >= 225 || pm >= 150))
            System.out.println("Eligible");
        else
            System.out.println("Not Eligible");
    }
}

Output

BlueJ output of Admission in a professional course is subject to the following criteria: (a) Marks in Physics >= 70 (b) Marks in Chemistry >= 60 (c) Marks in Mathematics >= 70 (d) Total marks in all subjects >= 225 Or Total marks in Physics and Mathematics >= 150 Write a program in Java to accept marks in these 3 subjects (Physics, Chemistry, and Mathematics) and display if a candidate is eligible.

Answered By

8 Likes


Related Questions