Proxy > Gmail Facebook Yahoo!

34. Admission to a professional course is subject to the following conditions: a) Marks in mathematics >=60 b) Marks in physics >=50 c) Marks in chemistry >=40 d) Total in all 3 subjects >=200 or Total in mathematics and physics >= 150 Given the marks in the three subjects, write a program to process the applications to list the eligible candidates



import java.util.*;

public class EligibleCandidate {
 
 
  public static void main(String[] args) {
    Scanner scan=new Scanner(System.in);
    System.out.print("Enter Marks in Math:");
    int mathMarks=scan.nextInt();
    System.out.print("Enter Marks in Physics:");
    int phyMarks=scan.nextInt();
    System.out.print("Enter Marks in Chemistry:");
    int chemMarks=scan.nextInt();
    boolean isEligible=isEligible(mathMarks,phyMarks,chemMarks) ;
    if(isEligible)
    {
      System.out.println("Candidate is Eligible");
    }
    else
    {
      System.out.println("Candidate is not Eligible");
    }
   
  }
 
 public static boolean isEligible(int mathMarks, int phyMarks, int chemMarks) {

        if (mathMarks < 60) {
            return false;
        } else if (phyMarks < 50) {
            return false;
        } else if (chemMarks < 40) {
            return false;
        } else if ((mathMarks + phyMarks + chemMarks) < 200) {
            return false;
        } else if ((mathMarks + phyMarks) < 150) {
            return false;
        } else {
            return true;
        }
    }
 
}


Responses

0 Respones to "34. Admission to a professional course is subject to the following conditions: a) Marks in mathematics >=60 b) Marks in physics >=50 c) Marks in chemistry >=40 d) Total in all 3 subjects >=200 or Total in mathematics and physics >= 150 Given the marks in the three subjects, write a program to process the applications to list the eligible candidates"


Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar