Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago