-
Notifications
You must be signed in to change notification settings - Fork 0
/
19-passing-students
35 lines (32 loc) · 1.1 KB
/
19-passing-students
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
public Boolean isPassed(Boolean passedExam, Boolean passedAssignments, Boolean passedProject) {
//code here
/* sol 1
if(passedExam && passedAssignments || passedExam && passedProject ) {
return true;
} else if (passedAssignments && passedProject || passedExam && passedAssignments ) {
return true;
} else {
return false;
} */
/* sol 2
if(passedExam == true && passedAssignments == true || passedExam == true && passedProject == true ) {
return true;
} else if (passedAssignments == true && passedProject == true || passedExam == true && passedAssignments == true ) {
return true;
} else {
return false;
} */
/* sol 3
if(passedExam && passedAssignments || passedExam && passedProject ) {
return true;
} else if (passedAssignments && passedProject || passedExam && passedAssignments ) {
return true;
}
return false; */
// sol 4
Integer count = 0;
if(passedExam) count++;
if(passedAssignments) count++;
if(passedProject) count++;
return (count >= 2) ? true : false;
}