ICSE Class 10 Computer Applications
Question 23 of 43
Conditional Constructs in Java — Question 23
Back to all questions 23
Question Question 23
Admission in a professional course is subject to the following criteria:
- Marks in Physics >= 70
- Marks in Chemistry >= 60
- Marks in Mathematics >= 70
- 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.
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
