-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCIGAR_PARTY.java
More file actions
28 lines (23 loc) · 806 Bytes
/
CIGAR_PARTY.java
File metadata and controls
28 lines (23 loc) · 806 Bytes
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
/*
When squirrels get together for a party, they like to have cigars.
A squirrel party is successful when the number of cigars is between 40 and 60, inclusive.
Unless it is the weekend, in which case there is no upper bound on the number of cigars.
Return true if the party with the given values is successful, or false otherwise.
cigarParty(30, false) → false
cigarParty(50, false) → true
cigarParty(70, true) → true
*/
package school;
public class CIGAR_PARTY {
public static void main(String[] args){
boolean answer = cigarParty(30,false);
System.out.println(answer);
}
public static boolean cigarParty(int cigars, boolean isWeekend) {
if(cigars>=40 && cigars<=60){
return true;
}else if (isWeekend==true && (cigars>40)){
return true;
}else {return false;}
}
}