Wednesday, February 3, 2016

Pass Interview

Pass Interview

Given the sex and the interview score of a candidate. Check whether the candidate has passed the interview.
  • If the candidate is male, the interview score should be equal or higher than 4.
  • If the candidate is female, the interview score should be equal or higher than 3.
For female candidate, the parameter sex is true because women are always the source of truth. So for men, sex is false.


Example
Given sex = true and score = 3 return true.
Given sex = false and score = 3, return false.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
public class Solution {
    /**
     * @param sex the sex of a candidate
     * @param score the interview score of a candidate
     * @return a boolean
     */
    public boolean passInterview(boolean sex, double score) {
        // Write your code here
        return score >= 4 || (score >= 3 && sex);
            
    }
}