Final answer:
A squirrel party is successful if the number of cigars is between 40 and 60, inclusive, unless it is the weekend. If it is the weekend, the party is successful regardless of the number of cigars.
Step-by-step explanation:
The given problem states that a squirrel party is successful when the number of cigars is between 40 and 60, inclusive. However, if it is the weekend, there is no upper bound on the number of cigars.
To determine if the party is successful, we need to check two conditions:
- If it is the weekend, return true since there is no upper bound on the number of cigars.
- If it is not the weekend, check if the number of cigars is between 40 and 60, inclusive. If it is, return true; otherwise, return false.
Example:
For the function call cigarParty(50, false), the function should return true because the number of cigars (50) is between 40 and 60, inclusive.