Answered step by step
Verified Expert Solution
Question
1 Approved Answer
how would I write a unit test for this code? /* When squirrels get together for a party, they like to have cigars. A squirrel
how would I write a unit test for this code?
/* 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 vazues is successful, or false otherwise. haveParty (30, false) false haveParty(50, false) true haveParty(70, true) true I public boolean haveParty(int cigars, boolean isweekend) \{ int minimumcigarcount =40; int maximumcigarcount =60; boolean hasNinimumCigars = cigars >= minimumCigarcount ; boolean withinMaxRangeofCigars = (!isweekend 8& cigars s= maximumCigarCount) 1 isWeekend; boolean successful = hasMinimuncigars \&\& withinMaxRangeofCigars; return successful; \}Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started