The Admission to a professional course is done using the following conditions.
a) Marks in Maths> =60
b) Marks in Physics >=50
c) Marks in chemistry >=40
d) Total in all the three subjects >=200 (or) Total in Maths and Physics >=150
Given the marks of three subjects, write a java program to process the applications to list the eligible candidates. (with if and if else only)
import java.util.Scanner;
public class Candidate {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int math,physics,chemistry;
System.out.print("Enter the marks obtained in Mathematics: ");
math=sc.nextInt();
System.out.print("Enter the marks obtained in Physics: ");
physics=sc.nextInt();
System.out.print("Enter the marks obtained in Chemistry: ");
chemistry=sc.nextInt();
if(math >= 60 && physics >= 50 && chemistry >= 40 &&
((math + physics + chemistry) >= 200 || (math + physics) >= 150)){
System.out.println("\nThe candidate is eligible for admission.");
}else{
System.out.println("\nThe candidate is NOT eligible for admission.");
}
sc.close();
}
}
Comments
Leave a comment